Google Tag Manager Community Templates
Introduction
Google Tag Manager (GTM) is a tool that allows marketers to manage and deploy marketing tags on a website without modifying the code. Ingenious Technologies offers multiple GTM tag templates to simplify the tracking implementation process. These templates are more user-friendly than traditional coding methods and come with advanced features like defaults and fallbacks for enhanced accuracy.
What are GTM Community Templates?
Community templates are pre-made configurations in GTM that can be easily imported and used, saving time and ensuring best practices are followed. They are especially beneficial for those who might not have deep technical knowledge.
Getting Started
1. Before You Start
First, determine which events you'd like to track, such as leads or sales. Ensure your advertiser setup is complete, including setting up conversion targets and other configurations.
Information needed later in the process:
Advertiser id
Tracking domain
These can be found in your advertiser’s configuration settings or under Trail > Tracking Tags.
Example:
2. Basics: Good to Know
A typical tracking implementation involves two tags:
Onpage Tag: Should be on every public page and registers incoming clicks.
Conversion Tag: Should be on the thank-you page (or after a conversion event) and registers conversions.
Ingenious Technologies offers GTM tags that can replace both these tags, suitable for client-side and server-side implementations.
3. Downloading the Template
While our GTM community templates are under review and not yet in the Google Template Gallery, they can be accessed and downloaded from our public Github repository.
Download Instructions:
Right-click and save the template files on your computer.
All files are named
template.tpl
(as required by GTM).
4. Importing the Template into GTM
Go to “Templates” in GTM and click “New”.
template section in GTMNavigate to the Menu and select “Import”. Choose your
template.tpl
file to import.Once imported, configure your tags as you would with any other GTM template.
Configuration & Setup
Once you've imported the templates, configuring your tags is similar to any other GTM template. Here's a breakdown of how the tags process data to create tracking calls:
Data Sources for Tag Configuration:
Variables: These are directly from the tag configuration.
First Party Cookies: Cookies stored on the user's browser related to your website.
DataLayer/Event Data: Information passed to GTM through the DataLayer or specific events triggered on the site.
Additionally, some variables have default values stored within the tag, ensuring there's always a value to fall back on.
Configuring your tags is similar to any other GTM template. Basically, just use your available placeholders.
Setting Up Variables
Configuring a variable in GTM is a seamless process:
Pre-defined Value: If you've specified a value in the tag settings, that value is prioritized.
DataLayer Check: In the absence of a pre-defined value, the tag checks the DataLayer for relevant information.
Default Value: If no value is found in the above steps, the tag reverts to its default value.
This flexible system ensures accurate tracking, even in complex setups, and facilitates easier testing of specific features.
Onpage Tracking Tag
This tag replaces the Onpage tag. It stores click-in data with a clickId
parameter in a cookie. Additionally, tsc
and tsv
cookies are written and used in tracking requests.
Fields | Description | Default |
---|---|---|
Tracking Domain | The tracking domain can be a Third-Party Ingenious Tracking Domain, a First-Party Ingenious Tracking Domain or a GTM Serverside Domain. You can find it on the platform under "Partnerships -> Advertiser -> Settings". |
|
Advertiser Id | You can find the advertiser ID on the platform under "Partnerships -> Advertiser -> Settings". Do not use the internal ID (mid). |
|
Redirect Mode | Overwrites the corresponding partner-specific default setting. It controls the way in which forwardings are set up. | 0 |
Customer Id | This specifies the internal customer ID from your system. |
|
User Value 1 | These fields are for free additional information. All formats are accepted. |
|
User Value 2 | These fields are for free additional information. All formats are accepted. |
|
Site Id | A short description of the page. |
|
Product Id | The unique identifier of the product. Use this, if this is a page that displays a specific product. |
|
Timestamp | Usage for cache invalidation. | A timestamp is generated when the tag is executed. |
Session Id | A session Id. The data type is string. |
|
HTTP Referrer | The complete Browser-URL on which the user comes from. | The referrer header is used. |
HTTP Location | The complete Browser-URL on which the tag was fired. | The current full URL is used. |
Gdpr | Activates the general data protection regulation according to TCFv2.0 |
|
Gdpr Consent | The actual tcfv2.0 string |
|
ECommerce Conversion Tracking Tag
This tag replaces the Ecommerce Conversion tag.
Fields | Description | Default |
---|---|---|
Tracking Domain | The tracking domain can be a Third-Party Ingenious Tracking Domain, a First-Party Ingenious Tracking Domain or a GTM Serverside Domain. You can find it on the platform under "Partnerships -> Advertiser -> Settings". | proxy.ingenious.cloud |
Advertiser Id | You can find the advertiser ID on the platform under "Partnerships -> Advertiser -> Settings". Do not use the internal ID (mid). |
|
Conversion Id | Unique conversion identifier from your system | gtmss_{currentTimestampMillis} |
Conversion Target | Defines an event and its type, for example Sale, Appinstall, Newslettersignup. | sale |
Tracking Currency | Determines the currency for all amounts. |
|
Unique Id | The unique ID is used to identify conversions during the validation process. |
|
Discount Value | This is the total net discount value. '0.00' is allowed. |
|
Discount Code | This is the applied discount code. |
|
Basket | The contents of the shopping cart consist of items containing the following values in JSON format |
|
Session Id | A session Id. The data type is string. |
|
Click Ids | A comma-separated list of click IDs. | uses _iclid Cookie |
Gdpr | Activates the general data protection regulation according to TCFv2.0 |
|
Gdpr Consent | The actual tcfv2.0 string |
|
Site Id | A short description of the conversion page. |
|
Timestamp | Usage for cache invalidation. | Current Timestamp in Millis |
HTTP Location | The complete Browser-URL on which the tag was fired. |
|
Customer Id | This specifies the internal customer ID from your system. |
|
Customer New | This specifies a new or existing customer. Use value 'true' for new customer or 'false' for existing customer. |
|
Pay Method | Customer payment method, for example 'credit card' or 'paypal'. |
|
User Value 1 | These fields are for free additional information. All formats are accepted. |
|
User Value 2 | These fields are for free additional information. All formats are accepted. |
|
Generating the 'basket' Variable Using a GTM Variable Template
The ECommerce Conversion Tracking Tag is crucial for capturing details about a purchase. One of the essential components of this tag is the basket
variable, which holds the product details of a purchase.
The 'basket' in Ingenious Conversion Tracking
The 'basket' in Ingenious Conversion Tracking represents a collection of product details for items a user intends to purchase. Here's a basic breakdown:
pid: Product ID.
prn: Product name.
brn: Brand name.
prc: Product category.
pri: Price.
qty: Quantity.
trc: Tracking category.
Translating Shop Data to Ingenious Format
Most online shops have their own GTM variables for shopping details. To integrate with Ingenious, this data needs to be mapped to the Ingenious basket format. Essentially, it's about matching your shop's GTM variable fields to the corresponding fields in the Ingenious format for seamless integration and accurate tracking.
Working in GTM we recommend the strategy to work with a dedicated basket
variable. There also is a template for this, to easily configure the basket:
1. Download the Variable Template:
Download the appropriate basket variable template here. Save it as file with the ending .tpl
2. Import the Variable Template into GTM:
Navigate to "Templates" from the left sidebar.
Click on the "New" button in the variable template section, go to the three dots and then select "Import."
Browse and select the downloaded variable template file.
Follow the on-screen instructions to successfully import the template.
3. Create the 'basket' Variable Using the Imported Template:
Once the template is imported, go to "Variables" from the left sidebar.
Click on the "New" button to create a new variable.
Name this variable "basket" or something descriptive.
For the variable type, select the imported template from the list of available templates.
4. Mapping Data in the Variable:
To start, fill in the variable that contains your basket information in the fields your basket
:
Now you can proceed and provide the name of the variables, that represent the needed basket values. Only mandatory ones need to be filled in. In case not variable is available, just leave it empty.
Within the variable configuration, you'll see fields that correspond to the product details (e.g., Product ID, Product Name, Price, etc.). Fill in the name of your variable.
Example:
Fields | Description | Requirement |
---|---|---|
basket | Represents your basket variable in GTM with your own basket format and product information | Mandatory |
position_order_number | optional: In case you want to have your own order number (1, 2, 3…) | Optional |
position_uuid | Every position has a UUID in the Ingenious basket format. It usually is created by the Ingenious system. Only provide it, in case needed (e.g. for automated validation process) or if available anyways | Optional |
product_id | Id of the product in your system | Recommended |
name | Name of the product | Recommended |
stock_keeping_unit | SKU | Optional |
brand_name | brand | Optional |
product_price | Price of the product. This price can be used for commissioning later. It should be without taxes, (unless tax must be included due to legal reasons). Price of one product (per piece), will be multiplied by quantity in the system later on. | Mandatory |
quantity | quantity: How many products were purchased?! | Mandatory |
tracking_category | alias of the tracking category (defined in the Ingenious system). You may leave this field empty. If left empty, | Optional |
discount_value | discount applied (of the whole position) | Optional |
shipping_costs | Shipping costs (of the whole position) | Optional |
tax | amount of tax (of the whole position) | Optional |
product_category | Name of your product category or hierarchy in the shop. | Optional |
More details and a description of each parameter can be found here: Configuring and implementing tracking tags | Basket tracking
Ensure that each field is correctly mapped to capture the desired product information.
5. Use the 'basket' Variable in the ECommerce Conversion Tracking Tag:
Navigate to "Tags" from the left sidebar.
Either create a new tag or edit an existing ECommerce Conversion Tracking Tag.
In the tag configuration, look in the section
eCommerce settings
for the field to select thebasket
variable. This will ensure that the tag captures the product details from thebasket
variable during a purchase event.Save and test the tag to ensure it's capturing the product details correctly.
6. Publish Changes:
Don't forget to submit your changes to make them live.
By following this method, you can efficiently generate the basket
variable in GTM using the new variable template and ensure accurate capture of product details during purchase events.
Implementing sGTM Templates
Server-side Google Tag Manager (sGTM) templates enable the deployment of tags directly on the server container, enhancing data security, improving site speed, and providing more control over data collection. This chapter focuses on implementing the sGTM client, sGTM onpage Tag, and sGTM conversion Tag.
Client side setup first
The setup of the client side templates (in the client side container) should be done first. See description above for onpage tag and conversion tag.
Important: For the client side templates, that are supposed to send data to the server side container, the tracking domain needs to be the tracking domain of your google tag manager.
sGTM Client Setup
Create a Server Container: In your GTM account, create a new server container if you haven't already.
Download sGTM client template: Download the sGTM client here.
Install the sGTM client template: Navigate to the “Templates” within your server container and click "New". Then import the template you just downloaded.
Deploy the sGTM Client: Navigate to the "Clients" section within your server container and click "New". Select the Ingenious Technologies sGTM client from the list of available templates.
Publish Changes: After configuring the sGTM client, publish the changes to make the client active. This step is crucial for ensuring that the server-side environment is ready to process incoming requests.
Implementing the sGTM Onpage Tag
Create a New Template: In your server container, create a new template and import the Ingenious Technologies sGTM Onpage Tag template.
Create a New Tag: In your server container, create a new tag and select the Ingenious Technologies sGTM onpage Tag template.
Configure the Tag: Fill in the required fields, such as specific settings related to your tracking needs. This tag is designed to capture and store click-in data, including generating and managing cookies for tracking purposes. Note: tracking domain is not needed and the advertiser Id is provided by the client side tag and the client.
Trigger Setup: Assign a trigger for the onpage tag, typically set to fire on all pages or based on specific conditions that match your tracking requirements.
Test and Publish: Before publishing, use the GTM preview mode to test the tag's functionality, ensuring it fires correctly and captures the desired data. Once verified, publish the changes.
Implementing the sGTM Conversion Tag
Create a New Template: In your server container, create a new template and import the Ingenious Technologies sGTM Conversion Tag template.
Create a Conversion Tag: Similar to the onpage tag setup, create a new tag in your server container for the sGTM conversion Tag. Choose the Ingenious Technologies template specifically designed for conversion tracking.
Tag Configuration: Input the necessary information, such as conversion ID, and any other relevant details that define the conversion event, such as conversion target, tracking currency, and basket details. Note: tracking domain is not needed and the advertiser Id is provided by the client side tag and the client.
Conversion Trigger: Define the trigger that will cause the conversion tag to fire. This is usually set to trigger on specific events, such as form submissions, purchases, or any other user actions that qualify as conversions.
Validation and Deployment: Use the GTM preview and debug mode to test the conversion tag's accuracy in capturing conversion events. Ensure all data is correctly recorded and matches your expectations. Once satisfied, publish the changes to deploy the conversion tracking.
Schema for server side implementation (sGTM)
In the provided illustration, we demonstrate a typical setup using Ingenious Tags:
Client-Side Installation: Both the Onpage Tag and the ECommerce Conversion Tag are set up on the client side.
Tracking Requests: These tags are tailored to direct their tracking requests to a server-side GTM container. This container is reachable through a first-party subdomain.
Server-Side Processing: Upon receiving these tracking requests, the server-side Ingenious client interprets them and transforms the requests into specific events.
Third-Party Integration: These Ingenious events can then activate third-party tags, allowing for a more integrated tracking system.
Server-Side Firing: Notably, while the Ecommerce Conversion Tag initiates from the server side, the Onpage Tag also triggers server-side, channeling the requests further into the Ingenious infrastructure.