Setting Up Web Tracking with GTM

How it works

This guide will provide step-by-step instructions on how you can set up your Data Talks Web Tracking using Google Tag Manager (GTM). First, you need to create and configure your domains and GTM containers in the CDP, and then finish the configuration in GTM.

In this guide, we are going to:

  1. Create a new Google Tag Manager container for your websites
  2. And then attach the Data Talks web tracking solution to capture Page View events.

In addition, the document provides you with the optional configuration required in order to capture the email of a logged-in user, and then collect information from web contact forms.

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

Step 1. Create Google Tag Manager Account

If you already have a GTM account, please go straight to Step 2.

  1. First, go to https://tagmanager.google.com to start the setup for the Google Tag Manager (GTM) and login with your Google credentials.
Create an account in GTM set up
GTM Landing page
  1. 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 “The Setup process” below.
    1. Fill out the Account Name, Country and Container Name fields accordingly. We will choose “Web” as the Target Platform.
    2. 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.
How to create an account in GTM
Create Account

Step 2. Data Talks Web Tracking for your Domains

If you finished your Google Tag Manager setting, there are only a few steps left. Let’s go to the Web Tracking Deployment page which you can find in the admin section of the CDP.

  1. Click the Configure New Domain button.
  2. Fill in the Domain Name and GTM Container ID.
    • Domain Name: This is the URL you are going to use to track web behavior. It is required to be written with a valid format of HTTP/HTTPS URL!
      For example: https://www.example.com
    • GTM Container ID: This is the ID of your Google Tag Manager account. You can find it after you have created an account on: tagmanager.google.com. The account is required to be written in a valid format which starts with ‘GTM-‘ and is followed by characters. The characters can only include uppercase alphabetical letters and numbers.
      For example: GTM-12EXAM3
  3. Register the new domain by clicking Save Changes.
    The portal will create an Application ID for each domain automatically which you will use inside GTM when configuring your websites.

Web Tracking Deployment Page in Admin

Now you can see the list of the domains you registered, delete each domain, and check their tracking status and the application ID created for each domain. You can use the application ID for the final changes explained below.

Step 3. Finish the Setup of your Google Tag Manager

3-1. File Upload

In order to make the GTM configuration as easy and fast as possible, use the attached .json files. They contain a template container configuration. By importing them to your GTM container, you are then able to set up your web tracking in just a few clicks. Continue to follow this guide to set it up correctly.

Files List

  1. First, start by visiting the Admin tab from the GTM navigation bar. If you log in to GTM and end up in the Workspace section, you will find the Admin tab on the right-hand side.
Click Admin tab
  1. By doing so, you will be directed to this menu (see the image below). In the right column, there is an option called Import Container. That is the option you need to select in order to proceed.
GTM Container Admin Page
  1. Next, you will be presented with a few options displayed in the following image that will be explained one by one below.
Import Container Page
  1. Select a file to import → Click the Choose container file button and select the .json file. appropriate for you.
    1. Click the Choose container file button and select the .json file. appropriate for you.
  2. Choose workspace and then → Select Existing and Default Workspace.
Select Workspace
  1. Choose an import option:
    1. If you do not have any other configuration within your GTM configuration, in other words, your container is empty, choose to Overwrite.
    2. In case you have configured a GTM container before, select Merge. Then, in the Merge option, select Overwrite conflicting tags, triggers, and variables.
Import Container page before Confirmation
  1. Finally, select Confirm.

3-2. Final Changes

There are a few changes you need to make in order to configure the container. Depending on the actions/tags you want to include in the container, you will need to make the following changes.

NOTE: The change included under Page View is required for every type of configuration.

Page View

In the Variables menu → choose User-Defined Variables, and then → choose Snowplow Analytics Settings. Here, we then need to change the value of the Application ID.

Application ID

Each domain you configure in the CDP will receive an application ID (app ID), a unique identifier which we will use to recognize and connect the visits to your site(s). The app ID is created automatically in the portal once you configure your domain on the Web Tracking page in the portal (see image below).

Where to find the created App ID

User Login

For User Login, you can follow the same instruction as above for Page View. In addition, you need to add one more script to your website. See this script below. Once you have added the script, please contact your Customer Success Manager to finalize the data import to the CDP.

window.addEventListener("load", function(){
              window.dataLayer = window.dataLayer || [];
              window.dataLayer.push({
                    "event" : "login",
                    "userId": "email-address-value-in-string-format" 
                });
            });

Form Tracking

From the Triggers menu, choose Form Submit. You need to change the third value (in this case, you need to replace the word demo) to a unique word contained within the page URL of the form you want to track. In order for this data to appear in the CDP, please contact your Customer Success Manager.

Form Tracking Configuration

Frequently Asked Questions

Q: What is the functionality of each tag you can install?

A: There are two tags, one for each functionality:

  • Pageview tag: a Pageview Event is fired every time a user visits a page within the website (a reload of the same page is considered a new Pageview Event). As long as they remain for more than 10 seconds, another event will be fired called Page Ping. This event is used to calculate the time spent within a single page or even the overall session within the website.
  • Form tracking tag: An Event of type Unstructured will be fired when the user submits a form from the webpage specified within the Google Tag Manager container.

Q: What data will be captured with each tag you install?

A: There are data generated by the tracker itself and there are data retrieved from the page.

  • Tracker-generated data:
    • Application ID: A unique identifier specified via the Google Tag Manager container, which is important for identifying the origin of the received data.
    • Domain User Id: A unique identifier stored in a cookie for this specific browser, so we can identify the user later on, even in a different session.
    • User ID: A unique identifier which is being used for assigning an email address for the logged-in users. Empty if not specified.
    • Event ID: A unique identifier for each event sent to our pipeline.
    • Domain Session ID: A unique identifier used to group events based on the session of a user.
    • Timestamp: Timestamp of the fired event in UTC.
  • Retrieved from the page:
    • Page Title
    • Page URL (We also receive on separate fields the URL path, port, query, scheme, fragment)
    • Page Referrer (Similar to Page URL, we additionally receive on separate fields URL referrer host, path, port, scheme, fragment, medium, source, term)
    • Browser Name
    • Operating System Name

Q: Is there any Personally Identifiable Information (PII) data that can be captured?

A: The only personally identifiable information we receive is the email address, but that is only applicable if the user is logged in and the log-in web tracking configuration is in place. And any other information collected from forms.

How to Pick a File

Here you will find some use cases, so you can easily determine which file to pick when configuring your GTM container.

Case 1:

You have a generic website and want to track page views and the time spent within every page view. In addition, you have previously configured a Google Analytics solution, which is still active, in the provided GTM container.

Solution:

To onboard yourself into our web tracking solution, you only have to import the page_view.json file. In this case, during the Overwrite/Merge procedure, you need to select Merge and Overwrite conflicting tags, triggers and variables. Don’t select Overwrite here, because that would remove the existing tags from your GA configuration. After importing the file you have to configure the value for the Application ID in the Web Tracking Deployment page in the CDP. Once this is done, publish the changes and your web tracking is live.

Case 2:

You have a website and want to track page views, time spent within every page view and form submissions. You have no prior configurations in your GTM container.

Solution:

To onboard yourself into our web tracking solution, you need to import the page_view.json file and the form_tracking.json file. First, start with the import of the page view file. Here you have the option to select either Overwrite or Merge. It will have no effect on this specific container since it’s empty. After configuring the Application ID, the next step is to import the form tracking file. Here you need to select Merge and Overwrite conflicting tags, triggers, and variables. Do not select Overwrite, because it would remove the tag/trigger/variable created by the page view file import. Finally, you can configure the third value in the Form-Submit trigger. Once this is done, publish the changes and your web tracking is live.

Case 3:

You’ve already implemented web tracking to your webshop. Currently, you’re tracking page views and the time spent, but you want to add user login tracking.

Solution:

To add the user login functionality to an existing page view configuration, you need to import the user_login.json file. Here we select Merge and Overwrite conflicting tags, triggers, and variables. It is important we overwrite the existing page view tag, so it will receive the extra configuration for the tag sequencing, coming from the user_login.json file. Once this is done, publish the changes.

Case 4:

You’ve already implemented web tracking to your website. You are also already tracking page views, time spent and an existing contact form. Recently, you added a newsletter subscription form and you want to track this form too.

Solution:

Adding the form tracking to the existing container requires some more configuration:

  1. First, you need to rename the existing tag, trigger and variable in order to be able to import again the form_tracking.json file. In other words, you need to rename the Form-Tracking tag, the Form-Submit trigger and the form-tracking variable to something that is close to the same meaning. For example, you could add the suffix contact. So the values would be, Form-Tracking-Contact, Form-Submit-Contact and form-tracking-contact.
  2. You will then be able to import the form_tracking.json file, select Merge and Overwrite conflicting tags, triggers and variables. And have both forms configured at the same time. To make the distinction of the forms even better, after the import, add a suffix to the newly added form. A possible option could be Form-Tracking-Newsletter, Form-Submit-Newsletter, or form-tracking-newsletter.
  3. Finally, you configure the third value of the Form-Submit-Newsletter trigger. Once this is done, publish the changes.

Case 5:

You have a webshop and you want to track page views, the time spent within every page view, a contact form as well as the logged-in users. In addition, you have previously configured a Google Analytics solution, which is still active, in the provided GTM container.

Solution:

To onboard yourself into our web tracking solution, you need to import the user_login.json and the form_tracking.json files. We are omitting the page_view.json, because the user_login.json not only covers everything the page_view.json provides but also adds the user login functionality. In case you want to add the page views tracking AND user login tracking you can directly import the user_login.json file.

  1. Starting with the import of the user login file, select Merge and Overwrite conflicting tags, triggers and variables.
  2. Then configure the value of the Application ID.
  3. Next, import the form tracking file and select Merge and Overwrite conflicting tags, triggers and variables.
  4. Finally, configure the third value in the Form-Submit trigger. Once this is done, publish the changes and your web tracking is live.

Powered by BetterDocs

Arrow-up