Quick start
This guide will walk you through the initial setup for Snowplow in Google Tag Manager.
Adding the Templates
To get started with Snowplow in Google Tag Manager, you will need to add the Snowplow Tag Template and the Snowplow Settings Variable Template to your GTM workspace.
Links to both templates can be found here.
Snowplow Tag Template
- Navigate to the
Templates
tab in your GTM workspace and click theSearch Gallery
button in theTag Templates
section.
- Search for "Snowplow v4"
- Click on the template, and then click
Add to Workspace
in the next screen. Review the permissions and clickAdd
to finalize the import.
Snowplow Settings Variable Template
The Snowplow Settings Variable template is used to configure the Snowplow tracker, such as the collector endpoint, privacy options, and tracker version. Although possible to use the Snowplow tag without the settings variable, it's highly recommended to use it for ease of configuration, along with keeping the tracker configuration separate from the tag.
- Again in the
Templates
tab in your GTM workspace, click theSearch Gallery
button in theVariable Templates
section.
Search for "Snowplow v4 Settings"
Click on the template, and then click
Add to Workspace
in the next screen. No permissions are required, so clickAdd
to finalize the import.
Configuring the Settings Variable
- Navigate to the
Variables
tab in your GTM workspace and clickNew
inUser-Defined Variables
.
Select
Snowplow v4 Settings
from the list of available variables.Under
Tracker Options
, enter your Snowplow collector endpoint set up when configuring your collector.
Under
JavaScript Tracker
, choose a hosting option. To get started quickly, select eitherunpkg
orjsDelivr
and enter a library version.Give your variable a name and click
Save
.
Implementing the Snowplow Tag
In this section, we will create a simple tag to fire a page view event.
- Navigate to the
Tags
tab in your GTM workspace and clickNew
.
Click on the
Tag Configuration
section and selectSnowplow v4
.Set the
Tag Type
toPage View
, if it is not already selected.Under
Tracker Initialisation
, select the Snowplow Settings variable we created earlier.Add a trigger to the tag. This will determine when the tag is fired. For a page view tag, you can use the built-in
All Pages
trigger.Give your tag a name and click
Save
.
Testing the Tag
To test the tag, you can use the GTM preview mode. Click the Preview
button in the top right of the GTM interface. This will open a new tab with your website and the GTM preview console.
Ensure that you see the Page View event in your Snowplow pipeline. If you don't have a full pipeline set up yet and are hosting the site locally, you can use Snowplow Micro, or Snowplow Inspector to check that the event is sent correctly.