This guide will provide step-by-step instructions on how you can set up your Data Talks Web Tracking using Google Tag Manager (GTM). To do so, you need to create and configure our web behavioral GTM container.
In this guide we are going to create a new container, attach the Snowplow Custom Templates and create a functioning tag for the Page View events. In addition, the document provides the optional configuration required in order to capture the email of a logged in user.
Requirements
Google Account
Add the container code into your website
Capture email address (optional)
Add the Data Layer code into your website
Provide the required values to the Data Layer
Create an account
First, go to https://tagmanager.google.com to start the setup for the Google Tag Manager (GTM) and login with your Google account.
GTM Landing page
After logging in, you need to create your account in GTM. NOTE: If you already have a container created for your account, you can skip this step and proceed directly to “Templates menu” below.
Fill the Account Name, Country and the Container Name fields accordingly. We will choose “Web” as the Target Platform.
Accept the Data Processing Terms by marking the checkbox at the bottom left and then Accept the GTM Terms of Service by pressing the Yes button on the top right corner.
Create Account
Templates menu
On the Tag Templates menu, we select “Search Gallery”, and we search for the “Snowplow Analytics” tag template. Then we add it to the workspace by clicking “Add to workspace” and proceed with adding when the popup appears (we do not want to confuse it with the “Snowplow Analytics v3“).
We need to make an extra configuration on this template. So, after adding the template, we access it and click on the “Permissions” tab.
Inside the Injects scripts we need to add the CDN (https://*.collector.datatalks.se/*), this will provide the sp file that’s required for tracking.
Add Tag Template
Add CDN to injected scripts
Similarly, we do for the Variable Templates, only this time we search for the “Snowplow Analytics Settings” and add it to the workspace (carefully to not mistake it with the “Snowplow Analytics v3 Settings). No extra configuration steps required for this template.
Variable Template
Variables menu
We click “New” in the User-Defined Variables (name this variable Snowplow Analytics Settings).
In the variable configuration we select from the Custom Templates the “Snowplow Analytics Settings”, then we configure the values. Once we are done, we click “Save”.
Settings
Value
Application Settings
Application ID
Please request the specific ID for your website (e.g. club-website) from Data Talks. No special characters are allowed.
Platform
Web
Privacy
Respect “Do Not Track”
False
Cookie Settings
State Storage Strategy
Cookie and Local Storage
Cookie Domain
auto
Cookie Name
sp
Cookie Lifetime
2 years
Cookie SameSite
Lax
Cookie Secure
True
Session Cookie Timeout
1800 (seconds)
Maximum Local Storage Queue Size
1000 (events)
Dispatching
Dispatch Method
POST
Encode into Base64
True
Page Unload Pause Length
500 (milliseconds)
Tracker Endpoint Protocol
Use page protocol
Buffer Size
1
POST Path
/com.snowplowanalytics.snowplow/tp2
Maximum POST Payload Size
40000 (bytes)
Predefined Contexts
Predefined Contexts
geolocation
Snowplow Analytics Settings User-Defined Variable
Capture email address of logged in user (optional)
We need to create another variable in order to get a user’s login email as it’s identification.
We click “New” in the User-Defined Variables (this variable needs to be named userId).
In the variable configuration we select from the Page Variables the “Data Layer Variable”, then we configure the values. Once we are done, we click “save”.
Settings
Value
Data Layer Variable Name
userId
Data Layer Version
Version 2
Data Layer User-Defined Variable
The following code needs to be inserted within the <head> of the page of the website in order to set the email address as the userId value.
Additionally, we need to make few adjustments into the Page View tag in order to make the setUserId tag work properly. At the bottom of the Tag Configuration, at the Advanced Settings → Tag Sequencing, we make the following adjustments.
Settings
Value
Fire a tag before Page View fires
Setup Tag
setUserId
Don’t fire PageView if setUserId fails or is paused
Overview
We select “Submit” → “Create Version”.
We provide a name and a description for the version of the container and click “Create”.
Create version
From the 3-dot menu within the version page we select “Publish”.
Publish container version
Container version replayed successfully
Form Tracking
This section provides the instructions for form tracking. We will have to repeat some of the steps from the pageviews, but with different configurations. Keep in mind that this is a complete custom implementation of the form tracking and it can be used independently from other tags.
Variables
We start by creating a new User-Defined Variable of type Custom JavaScript and we name the variable “form-tracking”. We insert the following code into the variable’s field.
We create a new Page View trigger, but this time on the “The trigger fires on” we select “Some Page Views”. When we select that choice, three fields will be prompted. We assign each field with the values in the following table.
Settings
Value
First Field
Page URL
Second Field
contains
Third Field
demo
The Third Field needs to contain the unique word included within the contact form Page URL (for example, demo or contact). That way, this trigger will be fired only when a user lands on this page.
Form Submit Trigger
Tags
We create a new tag, similarly to the Page View tag, of type “Snowplow Analytics” using the following table to configure it.
Finally, we attach to this tag the Form Submit trigger we created earlier, and save it.
Form tracking Tag
Overview
As a final step, we need to create a new version and publish it, in order to apply form tracking on our website. We follow the exact same steps from the ‘Overview’ section above.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services
We use browser cookies that are necessary for the site to work as intended.
For example, we store your website data collection preferences so we can honor them if you return to our site. You can disable these cookies in your browser settings but if you do the site may not work as intended.
To personalize and measure the effectiveness of advertising on our site and other websites.
For example, we may serve you a personalized ad based on the pages you visit on our site.
Cookie
Duration
Description
NID
6 months
The NID cookie contains a unique ID Google uses to remember your preferences and other information, such as your preferred language, your most recent searches, your previous interactions with an advertiser’s ads or search results, and your visits to an advertiser’s website. This helps us show you customized ads on Google.
To understand user behavior in order to provide you with a more relevant browsing experience or personalize the content on our site.
For example, we collect information about whic pages you visit to help us present more relevante information.
Cookie
Duration
Description
_hjid
a year
Hotjar cookie. This cookie is set when the customer first lands on a page with the Hotjar script. It is used to persist the random user ID, unique to that site on the browser. This ensures that behavior in subsequent visits to the same site will be attributed to the same user ID.
VISITOR_INFO1_LIVE
6 months
This cookie allows Youtube to check for bandwidth usage.
YSC
Session
Registers a unique ID to keep statistics of what videos from YouTube the user has seen.
To monitor the performance of our site and to enhance your browsing experience.
For example, these tools enable you to communicate with us via live chat.
Cookie
Duration
Description
__cfduid
a month
Cookie is set on websites using Cloudflare to speed up their load times and for threat defense services. It is does not collect or share user identification information.
_calendly_session
21 days
This cookie is associated with Calendely, a Meeting Schedulers that some websites employ. This cookie allows the meeting scheduler to function within the website.