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
- In Google Tag Manager, create an account or open yours.
- Create a container with the target platform Web.
- 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.
- Download gtm-container-template.json.
- In GTM, go to Admin › Import Container, choose the file, pick a workspace and select Merge › Rename conflicting tags, triggers, and variables.
- Open the variable GA4 Measurement ID and replace
G-XXXXXXXXXXwith your GA4 measurement ID. - Preview and publish (see step 4).
Or configure it yourself
- Google tag. Create a Google tag with your GA4 measurement ID, triggered on Initialization - All Pages.
- Data Layer Variables. Create a Data Layer Variable for each parameter you want to send, reading it from
ecommerce, for exampleecommerce.ob_channel_idorecommerce.ob_event_title. Ecommerce parameters such asitems,valueortransaction_iddo not need their own variables: GA4 reads them from the wholeecommerceobject. For that object, create a Data Layer Variable named for exampleDLV v1 - ecommerce, with the nameecommerceand Data Layer Version set to Version 1, so it contains the data of the current event only. - 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. - Other events. Repeat with a second trigger and tag for the other events you want, such as
loginorsign_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
- In GTM, click Preview and enter the URL of your sales channel.
- 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.
- In GA4, check Admin › DebugView.
- 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
- Event reference: every event and when it fires.
- Parameters: what each parameter contains.
- Consent: make sure your tags respect the buyer's choice.