Skip to main content

Set up Google Tag Manager

This guide connects your Google Tag Manager (GTM) container to a sales channel and sends the channel's events to Google Analytics 4 (GA4). The same container can send them to any other tool you use.

1. Create a GTM container​

  1. In Google Tag Manager, create an account or open yours.
  2. Create a container with the target platform Web.
  3. Copy its container ID, with the format GTM-XXXXXXX.

2. Connect it to your sales channel​

In the Control Panel, go to Channels › My channels › your channel › Configuration › External tools. In the Google Tag Manager (GTM) section, switch on Use Google Tag Manager, enter the Container ID and save.

This screen is available to users with the operator manager role, for web channels. If you do not have access, ask your Onebox customer success manager to configure it with your container ID.

Repeat it for every sales channel you want to measure. You can use the same container in several channels and tell them apart with the ob_channel_id parameter.

3. Configure your tags​

Start from the container template​

The fastest way is to import our container template, which already contains the variables, triggers and GA4 tags described below.

  1. Download gtm-container-template.json.
  2. In GTM, go to Admin › Import Container, choose the file, pick a workspace and select Merge › Rename conflicting tags, triggers, and variables.
  3. Open the variable GA4 Measurement ID and replace G-XXXXXXXXXX with your GA4 measurement ID.
  4. Preview and publish (see step 4).

Or configure it yourself​

  1. Google tag. Create a Google tag with your GA4 measurement ID, triggered on Initialization - All Pages.
  2. Data Layer Variables. Create a Data Layer Variable for each parameter you want to send, reading it from ecommerce, for example ecommerce.ob_channel_id or ecommerce.ob_event_title. Ecommerce parameters such as items, value or transaction_id do not need their own variables: GA4 reads them from the whole ecommerce object. For that object, create a Data Layer Variable named for example DLV v1 - ecommerce, with the name ecommerce and Data Layer Version set to Version 1, so it contains the data of the current event only.
  3. Ecommerce events. Create a Custom Event trigger with the event name ^(view_item_list|select_item|view_item|add_to_cart|remove_from_cart|view_promotion|select_promotion|begin_checkout|add_payment_info|purchase)$, with Use regex matching enabled. Then create a Google Analytics: GA4 Event tag with the event name {{Event}}, enable Send Ecommerce data with the data source Custom Object and the variable {{DLV v1 - ecommerce}}, add your custom parameters, and attach the trigger.
  4. Other events. Repeat with a second trigger and tag for the other events you want, such as login or sign_up. These do not need ecommerce data.

Never trigger tags on events that start with vrs_: listing the events you want, as above, keeps them out.

Page views​

The channel is a single-page application: the page does not reload when the buyer moves between steps. In GA4, keep Enhanced measurement › Page views › Page changes based on browser history events enabled in your web data stream, and page changes are measured automatically.

For other tools, trigger your page view tags on the custom event Page View, which the channel pushes on every page change.

4. Preview and publish​

  1. In GTM, click Preview and enter the URL of your sales channel.
  2. Browse an event, add tickets to the cart and go to checkout. In Tag Assistant, check that the events appear in the Data Layer tab and that your tags fire.
  3. In GA4, check Admin › DebugView.
  4. Publish the container. Changes reach the channel the next time a buyer loads it.

Use a test channel or the test environment to check purchases without real payments.

Next steps​