Skip to main content

Google Tag Manager

How to set up Google Tag Manager.

Written by Kate Thelwell

On July 1, 2023, Google replaced Universal Analytics with Google Analytics 4, their next-generation measurement solution.
​
Read and follow all the steps below to successfully link Google Tag Manager to an Access Tonic event.

Event Tracking

The ticket widget and checkout make use of the Analytics e-commerce metrics. Through this, your Analytics conversions will come as a 'purchase' event.
​
Access Tonic will also send the following events:

Event

Source

Description

view_item_list

Ticket Widget

Viewing ticket types for an event

add_to_cart

Ticket Widget

Selecting a ticket type

begin_checkout

Checkout

On entering the Checkout

purchase

Checkout

On completing a ticket purchase


Implement GTM codes in Access Tonic

  1. From your Access Tonic dashboard, click Manage for the applicable event.

  2. Select the Sales Tracking tab.

  3. Select Google Tag Manager tab.

  4. In the Configure box enter your Google Tag Manager ID, then click Save.

Untitled.png


Setting up Google Tag Manager

To send your data through from Google Tag Manager to Google Analytics you will need to configure your Tag to send event triggers. To do this, follow the steps for Google Tag Manager under "Collect ecommerce Data" in this Set up ecommerce events guide from Google.

⚠️ Important: Remember to tick 'Send e-commerce data'.


How Google Tag Manager data is forwarded

When the Access Tonic checkout is embedded on your website via the embeddable widget (ticket-widget-v2), GTM events from the checkout iframe are forwarded to the host page's dataLayer automatically.

The widget listens for postMessage events from the checkout iframe and pushes them to window.dataLayer on your page. This means your GTM container on the host page will receive the e-commerce events without any additional setup beyond the steps above.

Each event push clears the previous ecommerce object first (by pushing { ecommerce: null }) before pushing the new event data, following Google's recommended pattern to prevent data leakage between events.


Event data structures

view_item_list

Fired when a customer views the available ticket types for an event date.

Field

Type

Description

currency

string

ISO 4217 currency code (e.g. GBP, AUD)

item_list_name

string

The event name

selected_event_date

string

The selected occurrence date in YYYY-MM-DD format

items[].item_id

string

The ticket type ID

items[].item_name

string

The ticket type name

items[].price

number

Unit price including any admin/booking fees

items[].quantity

number

Always 1 for view_item_list

items[].item_category

string

Always "Access Tonic"

add_to_cart

Fired when a customer adds or updates ticket quantities in their cart.

Field

Type

Description

currency

string

ISO 4217 currency code

value

number

Total payable amount for the cart

items[].item_id

string

The ticket type ID

items[].item_name

string

The ticket type name

items[].price

number

Unit price including any admin/booking fees

items[].quantity

number

Number of tickets selected (0 if removed)

items[].item_category

string

Always "Access Tonic"

begin_checkout

Fired when a customer enters the checkout flow.


​purchase

Fired when a ticket purchase is completed.

The begin_checkout and purchase events share the same data structure:

Field

Type

Description

transaction_id

string

The purchase ID

value

number

Total amount to pay

currency

string

ISO 4217 currency code (e.g. GBP, AUD)

tax

number

Total VAT amount

selected_event_date

string | null

The event occurrence date in YYYY-MM-DD format

dmn_reference_id

string | null

The DMN purchase reference ID

coupon

string

Discount code applied (only present if applicable)

items[].item_id

string

Format: {EventID}_{TicketTypeId}

items[].item_name

string

The ticket type name

items[].price

number

Unit price including admin fees

items[].quantity

number

Number of tickets purchased

items[].item_brand

string

The event name

items[].item_category

string

Always "Access Tonic"

items[].coupon

string

Per-item discount code (only present if applicable)

items[].discount

number

Per-item discount amount (only present if applicable)


Custom booking tracking

If you have your own custom process, Access Tonic makes it easier to capture the purchase data and pass it down to your third party analytics software.


Access Tonic Checkout sends the purchase data using window.postMessage() functionality which can be captured using a JavaScript event listener.

// Example of capturing the payload sent by Tonic Checkout
window.addEventListener('message', function (event) {
if (event.origin === 'https://ticketing.designmynight.com') {
const { data } = event;
if (data && data.event === 'dmn_begin_checkout') {
// Implement your custom tracking for begin checkout event
myCustomTrackingBeginCheckoutEvent(data.payload)
}

if (data && data.event === 'dmn_purchase') {
// Implement your custom tracking for purchase completed event
myCustomTrackingPurchaseEvent(data.payload)
}
}
});

Tonic Checkout sends an object with the following data:

{
event: 'dmn_begin_checkout' when the purchase flow starts, or 'dmn_purchase' when the purchase was completed,
payload: EcommerceData,
}

The EcommerceData object has the following structure:

{
transaction_id: Purchase ID (string),
value: 20,
currency: 'GBP' or 'AUD',
tax: 4,
coupon: "coupon-code" (optional),
items: [{
item_id: {EventID}_{TicketTypeId},
item_name: {TicketTypeName},
price: 10,
quantity: 2,
item_brand: {EventName},
item_category: "Access Tonic"
}]
}

πŸ€“ Tip: Please see this Measure Ecommerce guide from Google for more information.



​Google Tag cross-domain tracking

The following steps for cross-domain tracking must also be completed.

  1. Ensure Google Tag Manager has been installed on your site as described in the Google Tag Documentation and the codes have been implemented into the Access Tonic event admin.

  2. Allow your Google Tag to run on our designmynight.com domain from your Analytics admin.

Your domains should look similar to our example below:


​

Did this answer your question?