Snowplow is a powerful event-tracking platform. When integrated with server-side Google Tag Manager (sGTM), it can give you even more control and flexibility over data collection management. In this guide, we’ll walk you through setting up pre-pipeline Snowplow tracking, which allows you to claim and process data before it reaches your Snowplow pipeline.
Armed with this knowledge, let’s dive into the setup process. Snowplow tracking with server-side GTM lets you start optimizing your data collection by providing greater control, accuracy, and flexibility.
Snowplow supports sending events to adjacent destinations by working with the server Google Tag Manager.
There are two high-level approaches to combining Snowplow and sGTM:
- Post-pipeline (Destinations Hub)
- Pre-pipeline
While both approaches can be helpful, we will now focus on the Pre-pipeline one. This is the second example in the picture above.
This approach gives you extra flexibility and control over data processing, one of the main advantages of using server-side GTM.
Sounds good, right? Let’s start with the integration right away.
Before setting up, please ensure your server-side GTM is configured: you are welcomed to read the article on how to set up Google Tag Manager server container. |
First, install Snowplow Client on our server container. You need that to claim a request from your JS tracker.Since the Client gallery is non-existent, you must do it manually.
1.1 Download the Snowplow Client template from GitHub.
1.2 Import the template into your server container.
Templates → Client Templates → New
1.3 Click the three dots in the upper right corner, and select Import.
1.4 Choose template.tpl that you just downloaded.
1.5 Hit Save.
1.6 Now, create a Client instance:
1.7 Do not change any default settings; give it a name and hit Save.
2.1 Snowplow tag is available in the Tag Manager Template Gallery.In a default scenario, the only adjustment to be made to the tag is to input your collector URL.
2.2 Give it a trigger.
Once configured with your Collector URL, the Snowplow Tag will automatically forward any events the Snowplow Client receives. |
Now that the server part is done, you must point your JS tracker to your server container subdomain.
3.1 If you are using web GTM to add a tracker to your site, you must change the collector endpoint in either the Snowplow Settings variable or directly in the tags.
3.2 If you’re adding the tracker with code:
snowplow('newTracker', "sp', "{{collector_url_heret?', {
appId: 'my-app-id',
discoverRootDomain: true,
cookieSameSite: 'Lax', // Recommended
contexts: {
webPage: true // default, can be omitted
}
}) ;
Test your setup as follows.
4.1 Launch the server container preview to see events claimed by the Snowplow Client and Snowplow Tag fire.
5.1 Don’t forget to publish your container(s) for the changes to apply!
With the above, you have started sending your Snowplow signal through a Google Tag Manager server. Server-side data tracking with Snowplow opens the possibilities of reporting to various destinations off of this data stream and redacting/enriching the data that your collector ultimately gets.
We will discuss these two scenarios in follow-up articles.
Happy tagging!
Stape has lots of tags for server GTM! Click on Try for free to register and check them all.