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

To obtain your tracker key(s), reach out to your Customer Support Manager.

GTM Templates

We provide the following two templates for use:

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:

  1. Add the template to your workspace.

  2. Using the New button in the Tag section, add a new tag.

  3. Select the XO Activities Tracking template. -> A configuration window opens.

  1. Add your tracker key in the assigned field.

  2. 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.

  3. Add one or more targets. A target is a key-value pair which corresponds to the target property of the activity object.

  4. 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).

  5. 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.

  6. Optional: Add any additional details around the activity, such as metadata, in the Activity information section.

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:

  1. Add the template to your workspace.

  2. Use the New button in the Tag section, add a new tag.

  3. Select the XO Multi-Activities Tracking template.

  1. Set up your variable in the "Target list" section.

Your variable should be an array of objects like in the following example:

"buyedProducts": [
    {id: "product1", "price": 100, quantity: 1},
    {id: "product2", "price": 50, quantity: 2}
]
  1. 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 and metadata.quantity fields in the resulting activity object.

  1. 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