AXON 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 Events Section for available events. |
event_data | object | The data for this event. See the Events Section 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:
Required Events
page_view
Event
To track Page View events with the AXON Pixel, under tags click New.
Give the new tag a name, like AXON - Page View
, then paste the following code into the Custom HTML tag configuration:
view_item
Event
Trigger this event when a user lands on a specific product page. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
currency | string | true | Three-letter ISO 4217 code for currency |
items | AXONItem[] | true | The items for the event |
value | number | false | Monetary value of the event, calculated by the sum of price × quantity for each item |
The AXON Item Object
AXONItem is a common object required with most events.
quantity
, price
, item_name
, and item_id
are required with this object and must be named and formatted exactly as shown in the table below:
Name | Type | Required | Description |
---|---|---|---|
item_id | string | true | The ID of the item |
item_name | string | true | The name of the item |
price | number | true | The monetary value of the item (in the user’s currency) |
quantity | number | true* | Item quantity |
item_category | string | recommended | The category of the item |
item_variant | string | recommended | The item variant or code |
image_url | string | recommended | The URL to an image of the item |
affiliation | string | false | The product’s affiliation to designate supplier or seller |
item_brand | string | false | The brand of the item |
item_category2 | string | false | The second category of the item |
*
quantity
not required forview_item
event
add_to_cart
Event
Trigger this event when a user adds an item to their cart. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
currency | string | true | Three-letter ISO 4217 code for currency |
items | AXONItem[] | true | The items for the event |
value | number | recommended | Monetary value of the items added to cart, calculated by the sum of price × quantity for each item |
begin_checkout
Event
Trigger this event when a user initiates the checkout process. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
currency | string | true | Three-letter ISO 4217 code for currency |
value | number | true | Monetary value of the event, calculated by the sum of price × quantity for each item |
items | AXONItem[] | true | The items for the event |
purchase
Event
Trigger this event when a user makes a purchase. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
currency | string | true | Three-letter ISO 4217 code for currency |
value | number | true | Monetary value of the event, calculated by the sum of price × quantity for each item |
transaction_id | string | true | The unique identifier of a transaction |
items | AXONItem[] | true | The items for the event |
user_id | string | recommended | The unique identifier for the customer |
shipping | number | recommended | Shipping cost associated with the transaction |
tax | number | recommended | Tax cost associated with a transaction |
Recommended Events
The remaining events listed below are recommended but not required:
remove_from_cart
Event
Trigger this event when a user removes an item from their cart. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
currency | string | true | Three-letter ISO 4217 code for currency |
value | number | recommended | Monetary value of the event, calculated by the sum of price × quantity for each item |
items | AXONItem[] | true | The items for the event |
generate_lead
Event
Trigger this event when a lead has been generated, for example through a form. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
user_id | string | true | The unique identifier for the customer |
login
Event
Trigger this event when a user logs into an account on the site. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
user_id | string | true | The unique identifier for the customer |
sign_up
Event
Trigger this event when a user signs up for an account on the site. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
user_id | string | true | The unique identifier for the customer |
method | string | recommended | The method used for sign up |
search
Event
Trigger this event when a user uses a search bar to search for content on your site. To send this event, include these parameters:
Name | Type | Required | Description |
---|---|---|---|
search_term | string | true | The term that was searched for |
results | AXONItem[] | recommended | The items for the event |
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: