Skip to main content

Google Tag Manager

David avatar
Written by David
Updated yesterday

Provide SoPost with your Google Tag Manager Tag ID. SoPost will expose the following data layer variables:

Data Layer Variable

Availability

Description

activityCode

Always available

A code that represents the consumer's activity through their journey.

activityName

Always available

The name for the journey.

activityId

Always available

The ID for the journey.

campaignCode

Always available

The campaign code, e.g. CMP-CARAGB-1.

campaignName

Always available

The campaign name.

campaignId

Always available

The campaign ID.

sessionId

Always available

The ID representing the consumer's browser session. When landing pages are embedded, they will get a new session every time they refresh the page.

orderId

Only available after submitOrder custom event.

The ID for their order.

productId

Only available after submitOrder custom event.

The ID for the product the consumer ordered.

productName

Only available after submitOrder custom event.

The name of the product the consumer ordered.

cookieConsentAnalytical

Always available

A boolean for whether the consumer agreed to the analytics purpose in the cookie banner.

cookieConsentMarketing

Always available

A boolean for whether the consumer agreed to the marketing purpose in the cookie banner.

You will also be able to listen for the following custom events:

Custom Event

Description

submitOrder

The event fired when the consumer submits their order request.

Allowing tags to be loaded onto the page

For security reasons, SoPost can only load content from trusted sources and this is controlled by a thing called "content security policies" or "CSPs". You will need to share with SoPost the domain(s) that the tags use before it will load successfully on the page.

For example, if you're using a custom tag in Google Tag Manager, and it's an image loaded from a URL and looks something like this:

<img
src="https://track.example.com/pixel.gif?
sessionId={{sessionId}}&
campaignId={{campaignId}}
width="1"
height="1"
style="display:none; border:0; margin:0; padding:0;"
/>

... you would share track.example.com with SoPost so they can add that domain to the "Allowed External Content" domains list for that data capture form.

Once that has been added to the allowed list, your tag will load successfully.

Managing consumer consent

If the cookie banner has been setup with Analytics and Marketing purposes, Google Tag Manager will load when at least one of the consent purposes has been accepted.

In Google Tag Manager, you will have to use the cookieConsentAnalytical or cookieConsentMarketing data layer variables to control which tags should load based on which purpose has been accepted.

For example, if "Pixel A" that you're loading in via Google Tag Manager is only for analytics, and "Pixel B" is only for marketing, you would use the cookieConsentAnalytical data layer variable (the value of that DLV would be true) to only load "Pixel A" assuming the consumer had only accepted the analytics purpose in this example.

Did this answer your question?