Example: Google Tag Manager Server Side#
You can use the HTTP target to send events to Google Tag Manager Server Side, where the Snowplow Client tag is installed.
To do this, you will need to include a transformation that converts your events to JSON — spEnrichedToJson.
Here’s an example configuration. Replace <your-gtm-host> with the hostname of your Google Tag Manager instance, and — optionally — <preview-token> with your preview mode token.
target {
use "http" {
url = "https://<your-gtm-host>/com.snowplowanalytics.snowplow/enriched"
request_timeout_in_seconds = 5
content_type = "application/json"
# this line is optional, in case you want to send events to GTM Preview Mode
headers = "{\"x-gtm-server-preview\": \"<preview-token>\"}"
}
}
transform {
use "spEnrichedToJson" {}
}