Find out how to install the Pixel in your Web or Server container in Google Tag Manager
This documentation guides you through the steps required for configuring and installing the Aqurate Pixel. This is applicable to you if:
-
you use client-side tagging, but prefer that you or your developer(s) setup the Pixel
-
you use server-side tagging
-
you have a non-standard data layer implementation
Client-side tagging
Here are the steps you’ll have to go through:
-
Request the
aq-gtm-template.json
from support@aqurate.ai -
Go to Google Tag Manager and select the container installed in your shop
-
From the Admin tab, click on Import Container
-
Click Choose container file and select the
aq-gtm-template.json
file -
Create a New workspace named Aqurate Pixel
-
Choose the Merge import option, then Overwrite conflicting tags
-
Hit Confirm, then Submit (in the top-right), then Publish
Server-side tagging
Overview
There are 2 scripts that you must add to your website:
-
aq-config.js
-
it populates the
aqpx
variable with information from several data layer variables -
the
aqpx
variable is a dictionary of key-value pairs defined as per the schema below -
in the template provided to you, some values are written in GTM notation eg, {{_event}} . Please update these as necessary for your specific setup.
-
-
aqpx.js
-
consumes data from the
aqpx
variable defined inaq-config.js
-
transforms the data and sends it to Aqurate’s collector pipeline at
https://tracker.aqurate.ai
-
Steps
Here are the steps you’ll have to go through:
-
Request the
aq-config.js
andaqpx.js
template scripts from support@aqurate.ai -
If necessary, update the
aq-config.js
script to match your data layer format as per the schema and examples below. Here are examples of key-value pairs that might require changes, based on your specific setup:-
variables relying on GTM’s double curly brackets notation and data layer variables:
-
event: {{_event}}
clickElement: {{Click Element}}
clickUrl: {{Click URL}}
ecommerce: {{ecommerce}}
currency: ({{ecommerce}} || {}).currency || "CST"
-
- variables relying on your event names:
actions.detail
, if you have a custom name for theview_item
eventactions.purchase
, if you have a custom name for thepurchase
eventactions.add
, if you have a custom name for theadd_to_cart
event
-
optional variables if you have a non-standard data layer implementation (ie, different from the UA/GA4 schema)
-
customDL.disableAutoData
-
customDL.data.detail
-
customDL.data.add
-
customDL.data.purchase
-
-
-
Add the scripts in your website (first
aq-config.js
, thenaqpx.js
) and trigger them on these events (or their equivalent, if you have a non-standard data layer implementation):-
view_item
-
add_to_cart
-
purchase
-
gtm.linkClick
-
gtm.click
→ only if the click is on the Add to cart button in an Aqurate widget. You can confirm this by checking if this expression is true:gtm.element.closest(aqpx.classes.widgets) && gtm.element.closest(aqpx.classes.add)
-
Configuring the aqpx variable
The aqpx
variable is built as a dictionary with key-value pairs. You may omit any optional keys.
Key |
Type |
Example |
Optional |
Description |
---|---|---|---|---|
appId |
string |
|
No |
The client ID assigned by Aqurate. |
platform |
string |
|
No |
The shop platform. Can be one of:
|
ecommerce |
Data Layer variable |
|
No |
The |
event |
Data Layer variable |
|
No |
The |
clickElement |
Data Layer variable |
|
No |
The |
clickUrl |
Data Layer variable |
|
No |
The |
actions |
dictionary |
|
No |
Used to match |
actions.detail |
array of strings |
|
No |
At least one string in this array must match the |
actions.purchase |
array of strings |
|
No |
At least one string in this array must match the |
actions.add |
array of strings |
|
No |
At least one string in this array must match the |
currency |
string |
|
No |
Three-letter ISO currency code, in lowercase. The default value in the examples below extracts it from the |
classes |
dictionary |
|
No |
Used to check if the |
classes.widgets |
string |
|
No |
Comma-separated CSS selectors (element ID or classes) that match Aqurate widgets. Used as a fall-back mechanism to capture |
classes.add |
string |
|
No |
Comma-separated CSS selectors (element ID or classes) that match the Add to cart buttons inside Aqurate widgets. Used to capture |
debug |
boolean |
|
No |
Used to debug the Aqurate Pixel. |
customDL |
dictionary |
|
Yes |
Used to push specific values for eCommerce data, instead of relying on the Pixel |
customDL.disableAutoData |
boolean |
|
Yes |
If you have a standard data layer implementation, omit this key or set it to |
customDL.data |
dictionary |
|
Yes |
Used to push specific values for eCommerce data, instead of relying on the Pixel mechanism of auto-extracting data from the data layer. If you have a non-standard data layer implementation, this is highly recommended. |
customDL.data.detail |
dictionary |
|
Yes |
Used to push specific values for the |
customDL.data.detail.items |
array of item objects |
The expression should evaluate to a value in this format: [ |
Yes |
A list of item objects that match the UA or GA4 schema, as per the Google Analytics documentation. Should contain only item object ie, the viewed product. |
customDL.data.purchase |
dictionary |
|
Yes |
Used to push specific values for the |
customDL.data.purchase.items |
array of item objects |
The expression should evaluate to a value in this format: [ |
Yes |
A list of item objects that match the UA or GA4 schema, as per the Google Analytics documentation. Should contain one or more item objects ie, the bought products. |
customDL.data.purchase.id |
string |
The expression should evaluate to a value in this format:
|
Yes |
The unique identifier of the order ie, |
customDL.data.purchase.value |
number |
The expression should evaluate to a value in this format:
|
Yes |
The value of the order ie, |
customDL.data.purchase.tax |
number |
The expression should evaluate to a value in this format:
|
Yes |
The tax amount of the order ie, |
customDL.data.purchase.shipping |
number |
The expression should evaluate to a value in this format:
|
Yes |
The shipping amount of the order ie, |
customDL.data.add |
dictionary |
|
Yes |
Used to push specific values for the |
customDL.data.add.items |
array of item objects |
The expression should evaluate to a value in this format: [
{
item_id: "SKU_12345",
item_name: "Stan and Friends Tee",
item_brand: "Google",
item_category: "Apparel",
price: 10.01,
quantity: 3
}
]
|
Yes |
A list of item objects that match the UA or GA4 schema, as per the Google Analytics documentation. Should contain only item object ie, the product added to cart. |
customDL.filters |
dictionary |
|
Yes |
Used to send data for events only when they match additional conditions |
customDL.filters.detail |
boolean |
|
Yes |
Used to send data for the |
customDL.filters.purchase |
boolean |
|
Yes |
Used to send data for the |
customDL.filters.add |
boolean |
|
Yes |
Used to send data for the |
user |
dictionary |
|
Yes |
Used to send user identifiers for users that are logged-in |
user.logged |
boolean |
|
Yes |
An expression evaluating to If |
user.id |
string |
|
Yes |
The user identifier of the logged-in user. If |
user.email |
string |
|
Yes |
The email of the logged-in user. If not available, set to empty string |
anonymize |
boolean |
|
Yes |
If |
debugMode |
boolean |
|
Yes |
If |
Example 1 - standard aq-config (only mandatory fields)
function() {
var aqpx = {
appId: '1',
platform: 'shopify',
ecommerce: {{ecommerce}},
event: {{_event}},
clickElement: {{Click Element}},
clickUrl: {{Click URL}},
actions: {
detail: ['view_item', '__sm__view_product'],
purchase: ['purchase', 'conversion', 'transaction', 'prestashop_order_confirmation', 'wd_tranzactie_finalizata'],
add: ['add_to_cart', 'addToCart', '__sm__add_to_cart']
},
currency: ({{ecommerce}} || {}).currency || "CST",
classes: {
widgets: '#app-content, .aqurate-personalize',
add: '.aqurate-add-to-cart'
},
debugMode: false
}
return aqpx;
}
Example 2 - extended aq-config (all optional fields)
function() {
var aqpx = {
appId: '1',
platform: 'shopify',
ecommerce: {{ecommerce}},
event: {{_event}},
clickElement: {{Click Element}},
clickUrl: {{Click URL}},
actions: {
detail: ['view_item', '__sm__view_product'],
purchase: ['purchase', 'conversion', 'transaction', 'prestashop_order_confirmation', 'wd_tranzactie_finalizata'],
add: ['add_to_cart', 'addToCart', '__sm__add_to_cart']
},
currency: ({{ecommerce}} || {}).currency || "CST",
classes: {
widgets: '#app-content, .aqurate-personalize',
add: '.aqurate-add-to-cart'
},
customDL: {
disableAutoData: false,
data: {
detail: {
items: null
},
purchase: {
items: null,
id: null,
value: null,
tax: null,
shipping: null
},
add: {
items: null
}
},
filters: {
detail: true,
purchase: true,
add: true
}
},
user: {
logged: false,
id: '',
email: ''
},
anonymize: false,
debugMode: false
}
return aqpx;
}