AXON Pixel Google Tag Manager Integration
This guide assumes that you have a Google Tag Manager (GTM) account with a Data Layer that receives e-commerce 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 set up the Data Layer to provide data to GTM.
Installing the AXON Pixel
-
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 AppLovin Account.
-
Click under Triggering and select Initialization - All Pages. This ensures that the AXON Pixel loads on all pages. Click Save.
Tracking Events with the AXON Pixel
To send an occurrence of an e-commerce event to AXON, use the following syntax. Each event should trigger when its corresponding event happens in the data layer.
Parameters
Name | Type | Description |
---|---|---|
event_name | string | The name for this event. See the AXON Pixel Events and Objects for available events. |
event_data | object | The data for this event. See the AXON Pixel Events and Objects below 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.
Passing Data to the AXON Pixel
There are two ways to populate the event in GTM:
Method 1: Single GTM Variable
For each of the events that require event_data
, AppLovin recommends that you create a GTM Variable that is the payload.
For example,
(where {{ AXON - Add To Cart }}
is a GTM Variable you create).
Method 2: Composition of GTM Variables
You can also build the object composed of multiple Variables. For example:
Enhanced User Identification (Recommended)
The AXON Pixel sets the first-party cookie _axwrt
to identify users.
This cookie is automatically sent in every request to your website.
To enhance user identification, AppLovin strongly recommends that you perform 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.
- The value of this cookie should be the same as the value of the corresponding cookie passed in the request.
- The domain for the cookie should be your site, prefixed with a period.
For example, if your site is
mysite.com
, the domain attribute should be.mysite.com
. Note: “www” should not be included here. - The path for the cookie should be
/
. - Do not set the cookie to be
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: