Stape
Search
Try for free

Snowplow tracking integration with server Google Tag Manager

Updated
Oct 21, 2024
Published
Oct 18, 2024

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.

Overview of Snowplow tracking

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.

Benefits of pre-pipeline approach with server-side tagging

  • The setup is easy thanks to the wide selection of available tags and the familiar, user-friendly GTM interface.
  • You can clearly see every transformation your data goes through, ensuring complete transparency at each process step. This level of control and visibility will make you feel secure and in charge of your data.
  • All data remains in your private cloud until you choose to forward it, ensuring its safety and your peace of mind.

Sounds good, right? Let’s start with the integration right away.

How to integrate Snowplow with sGTM

Step 1. Install Snowplow Client on your server container

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.2 Import the template into your server container.

TemplatesClient TemplatesNew

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.

Step 2. Add Snowplow tag

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.

Step 3. Point your JS tracker to your server container's subdomain

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 } }) ;

Step 4. Test your setup

Test your setup as follows.

4.1 Launch the server container preview to see events claimed by the Snowplow Client and Snowplow Tag fire.

Step 5. Publish your container(s)

5.1 Don’t forget to publish your container(s) for the changes to apply!

To sum up

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!

Host your GTM server at Staperight now!