Google Tag Manager
Track user activities with Google Tag Manager using Crownpeak's provided GTM templates for streamlined front-end tracking implementation.
Use the provided Google Tag Manager (GTM) templates to track user activities.
Prerequisites
Configured GTM container
Data layer containing the information to be tracked (if possible)
Tracker key
To obtain your tracker key(s), reach out to your Customer Support Manager.
GTM Templates
We provide the following two templates for use:
XO Activities Tracking: Use for sending one activity event for each user action
XO Multi-Activities Tracking: Use for sending mutiple activity events for a single user action
Access these templates by clicking the links above. Alternativey, in the Community Template Gallery, search for "XO Activities Tracking" or "XO Multi-Activities Tracking".
The XO templates are used for both FHR and XO.
XO Activities Tracking
The XO Activities Tracking template is the main template. Use this template to send one activity event for each user action:
Add the template to your workspace.
Using the New button in the Tag section, add a new tag.
Select the XO Activities Tracking template. -> A configuration window opens.
Add your tracker key in the assigned field.
Choose an action. Each field corresponds to a variable, which means that you can configure multiple actions on the tag if your variable is dynamic. Otherwise, you should have an individual tag for each tracking action.
Add one or more targets. A target is a key-value pair which corresponds to the target property of the activity object.
Add one or more identities. An identity is a key-value pair. The key corresponds to the name of the identity (such as: "sessionId") and the value to the ID of that identity for the visitor (the actual session ID).
Optional: Add any additional information about the user, such as traits, or segments, in the User information section. These fields correspond to the different parts of the user object.
Optional: Add any additional details around the activity, such as metadata, in the Activity information section.
The section Advanced Settings is not part of the XO tag configuration.
Example
A basic tracking configuration for events that relate to a single product should look like this:
XO Multi-Activity Tracking
Use this template to send multiple activity events for a single user action, such as when a user purchases multiple items in their basket:
Add the template to your workspace.
Use the New button in the Tag section, add a new tag.
Select the XO Multi-Activities Tracking template.
For the most part, you can use this template in the same way as the XO Activities Tracking template. The key difference in the requirement of a variable containing all the necessary product information.
Set up your variable in the "Target list" section.
Your variable should be an array of objects like in the following example:
To set product-specific values for an event, add rows to the Attributes section. Each row corresponds to a different value in your variable, and allows you to define what it will be mapped to in the activity object. In the following example, we will map the ID, price and quantity from our variable (the input object) to the
target.product
,metadata.price
andmetadata.quantity
fields in the resulting activity object.
Each tracker key can only be used with a single currency.
To set information that is specific to this group of events, and not each product (eg: orderId or currency) you can add them in the common section.
Last updated