This guide assumes that you have a Google Tag Manager (GTM) account with a Data Layer that receives ecommerce events such as viewing a product, add to cart, and checkout.
This guide also assumes that you are familiar with the core GTM concepts: tags, triggers, variables, and the data layer. This guide does not explain how to configure the Data Layer to provide data to GTM.
Log in to your Google Tag Manager account. Click your website’s container, and under Tags, click New. For Tag Configuration, choose Custom HTML. Enter a name, for example “Axon — Init”.
Copy and paste the following code into your tag. Replace “«your-event-key»” with the key from your Axon Account.
Click under Triggering and select Initialization - All Pages. This ensures that the Axon Pixel loads on all pages. Click Save.
To send an occurrence of an ecommerce event to Axon, use the following syntax. Each event should trigger when its corresponding event happens in the data layer.
| Name | Type | Description |
|---|---|---|
event_name | string | The name for this event. See Axon Pixel events and objects for available events. |
event_data | object | The data for this event. See Axon Pixel events and objects for data to send. (Note: you do not need to send event_data with page_view.) |
All events require the event_name argument.
Each event except for page_view also requires certain event_data, described in the event-specific sections below.
There are two ways to populate the event in GTM:
For each of the events that require event_data, Axon recommends that you create a GTM Variable that is the payload.
For example,
(where {{Axon - Add To Cart}} is a GTM Variable you create).
You can also build the object composed of multiple Variables. For example:
The Axon Pixel sets the first-party cookie _axwrt to identify users.
Each subsequent request to your website includes this cookie.
To enhance user identification, Axon strongly recommends that you do the following on the back-end of your site:
Whenever you see the cookie _axwrt in an HTTP request, set the HTTP response such that it includes a header that sets a new first-party HTTP cookie axwrt (removing the underscore) with a one-year expiration date.
mysite.com, the domain attribute should be .mysite.com.
Note: do not include “www”./.HttpOnly.For example, if your site sees an HTTP request where the value of cookie _axwrt is xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, then add to your response the header:
If you have a Shopify site, integrate with the Axon Shopify app instead.
Before you begin, check that your GTM configuration works on all pages of your site.
However, if your site runs Shopify in headless mode, make sure to install the Shopify app to capture events on your checkout page. In a Shopify headless setup:
The Axon Pixel should load and initialize on each page of your site. Ensure that your GTM Initialization - All Pages Trigger fires on each page to which you send an event.
Purchase flows:
At a minimum, provide page_view, view_item, add_to_cart, begin_checkout, and purchase events.
Also include sign_up or login if your site uses these events.
Lead generation flows:
At a minimum, provide page_view and generate_lead events.
The Axon Pixel is compatible with the Google Analytics 4 (GA4) API.
If your Data Layer is configured to store data in GA4 format, then you can pass those Data Layer Variables directly to the tag itself.
For example, if {{GA - Ecommerce}} refers to the ecommerce field of your Data Layer which is configured like GA4, you can pass it directly to the Pixel with:
This saves you from needing to create any intermediate Variables.
If your Data Layer is not configured like GA4, you may need to create new Variables for the Axon Pixel.