| **purchase** | PLACE_ORDER (place-order:success) | - the transaction_id is the order’s refNo hashed using sha256<br>- the value is the order’s grossDiscounted price and it should reflect the total amount the shopper has to pay<br>- the item’s price is the item’s net discounted price<br>- the item’s coupon key is only present if a coupon is applied<br>- the order’s coupon key is only present if an order coupon is applied | ```json
[
"event",
"purchase",
{
"transaction_id": "11741538",
"value" : 84.03,
"tax" : 15.97,
"shipping" : 11.02,
"currency" : "USD",
"coupon" : "promotion-code",
"items" : [
{
"category": "REGULAR",
"id" : 4591180,
"name" : "Antivirus 2016",
"price" : 84.03,
"quantity": 1,
"coupon" : "coupon_code",
"group" : "General",
"tax" : 20.5
}
]
}
]
``` |
| **remove_from_cart** | DELETE_ITEM (delete-item) | - the item’s coupon key is only present if a coupon is applied<br>- the value is the order’s net discounted price<br>- the item’s price is the item’s net discounted price, not taking quantity into account<br>- the order’s coupon key is only present if an order coupon is applied | ```json
[
"event",
"remove_from_cart",
{
"items": [
{
"category": "REGULAR",
"id" : 4591180,
"name" : "Antivirus 2016",
"price" : 84.03,
"quantity": 1,
"coupon" : "coupon_code",
"group" : "General",
"tax" : 20.5
}
],
"coupon" : "promotion-code",
"value": 84.03
}
]
``` |
| **page_redirect** | LOAD_PAGE (load-page) | Is only triggered if the cart is redirected to the retry page | ```json
[
"event",
"page_redirect",
{
"event_label" : "Retry",
"event_category" : "2checkout_non_interaction_event",
"non_interaction": true
}
]
``` |
### Google Analytics 4
The Google Analytics 4 DataLayer is an array of arrays. Each event pushed in the DataLayer is an array with various indexes, based on the type of the triggered event:
- The first element of the array determines the type of payload added to the DataLayer (it can either be event or config).
- The second element of the array determines the sub-type of the first element.
- The third element is an object with the actual data/payload.
| Event | Triggered by | Notes | Example |
| --- | --- | --- | --- |
| **begin_checkout** | LOAD_CART (load-cart) | - the item’s price is the item’s net discounted price, taken from the item’s key named itemNetDiscountedPrice<br>- the item’s price should not be calculated with the item’s quantity<br>- the item’s coupon key is only present if a coupon is applied<br>- the order’s coupon key is only present if an order coupon is applied | ```javascript
[
"event",
"begin_checkout",
{
"currency": "USD",
"value" : "177.89",
"coupon" : "promotion-code",
"items" : [
{
"category" : "REGULAR",
"item_id" : 4591180,
"item_name": "Antivirus 2016",
"price" : 50,
"quantity" : 1,
"coupon" : "coupon_code",
"group" : "General",
"tax" : 20.5
}
]
}
]
``` |
| **purchase** | PLACE_ORDER (place-order:success) | - the transaction_id is the order’s refNo hashed using sha256<br>- the value is the order’s grossDiscounted price and should reflect the total amount the shopper has to pay<br>- the item’s price is the item’s net discounted price<br>- the item’s coupon key is only present if a coupon is applied<br>- the order’s coupon key is only present if an order coupon is applied | ```json
[
"event",
"purchase",
{
"transaction_id": "11741538",
"value" : 84.03,
"tax" : 15.97,
"shipping" : 11.02,
"currency" : "USD",
"coupon" : "promotion-code",
"items" : [
{
"item_category": "REGULAR",
"item_id" : 4591180,
"item_name" : "Antivirus 2016",
"price" : 84.03,
"quantity" : 1,
"coupon" : "coupon_code",
"group" : "General",
"tax" : 20.5
}
]
}
]
``` |
| **remove_from_cart** | DELETE_ITEM (delete-item) | - the item’s coupon key is only present if a coupon is applied<br>- the value is the order’s net discounted price<br>- the item’s price is the item’s net discounted price, not taking quantity into account<br>- the order’s coupon key is only present if an order coupon is applied | ```json
[
"event",
"remove_from_cart",
{
"items": [
{
"item_category": "REGULAR",
"item_id" : 4591180,
"item_name" : "Antivirus 2016",
"price" : 84.03,
"quantity" : 1,
"coupon" : "coupon_code",
"group" : "General",
"tax" : 20.5
}
],
"currency": "USD",
"coupon" : "promotion-code",
"value" : 84.03
}
]
``` |
| **page_redirect** | LOAD_PAGE (load-page) | Is only triggered if the cart is redirected to the retry page | ```json
[
"event",
"page_redirect",
{
"event_label" : "Retry",
"event_category" : "2checkout_non_interaction_event",
"non_interaction": true
}
]
``` |
| **add_to_cart** | ADD_ITEM (add-item) | - the item’s coupon key is only present if there is an active product coupon code (coupon / auto-apply)<br>- the item’s price is the item’s net discounted price<br>- the item's format key for cross-sell product may be:<br> - “cross_sell” for products displayed in a listing, as recommended products;<br> - “auto_cross_sell” for cross-sell products auto added in the cart;<br> - “main” for products which are not cross sell. | ```json
[
"event",
"add_to_cart",
{
"items": [
{
"item_category": "REGULAR",
"item_id" : 4591180,
"item_name" : "Antivirus 2016",
"price" : 84.03,
"quantity" : 1,
"group" : "General",
"tax" : 20.5,
"format" : "cross_sell"
}
],
"currency": "USD",
"value": 84.03
}
]
``` |
| **view_item_list** | LOAD_CROSS_SELL (load-cross-sell) | - the item’s price is the item’s net discounted price<br>- the item's index key is the position of the product in the cross-sell listing | ```json
[
"event",
"view_item_list",
{
"currency": "USD",
"item_list_id": "cross-sell products",
"item_list_name": "cross-sell products",
"items": [
{
"item_name": "Antivirus 2018",
"item_id": 7628300,
"price": "27.9",
"discount": "3.10",
"type": "Physical",
"group": "General",
"format": "cross_sell",
"index": 0
},
{
"item_name": "Antivirus 2020",
"item_id": 7635736,
"price": "55.88",
"discount": "13.96",
"type": "Electronic",
"group": "General",
"format": "cross_sell",
"hiddenAdditionalFields": [
{ "Additional hiddenfield": "" }
],
"index": 1
}
]
}
]
``` |
### Google Tag Manager with Universal Analytics
For Google Tag Manager with Universal Analytics, the DataLayer is an array of objects. The object payload passed to the DataLayer is mainly made up of two keys: event & ecommerce.
The event key determines the type of event passed to the Datalayer, while the ecommerce key holds the eCommerce object with all the relevant event data.
Both Google Tag Manager and Adobe’s Dynamic Tag Manager follow the same advanced eCommerce layout and they also have the ability to support Custom Events (cartUpdated). See the Custom events (cartUpdated) section below.
| Event | Triggered by | Notes | Example |
| --- | --- | --- | --- |
| **checkout** | - LOAD_CART (load-cart)<br>- SET_ECOMMERCE (set-ecommerce) | - the actionField’s step will always be 1 as the checkout page is the first action field<br>- the product’s price key is the item’s net discounted price<br>- the product’s hiddenAdditionalFields key is only present if the product has hidden additional fields<br>- the product’s options key is only present if the product has active options<br>- the actionField’s coupon key is only present if there is a valid order promotion present<br>- the actionField’s orderDiscountCoupon key is only present if there is a valid order promotion present (defaults to 'auto-apply' if the promotion doesn’t have a promotion coupon) | ```json
{
"event":"checkout",
"ecommerce":{
"currencyCode":"USD",
"checkout":{
"actionField":{
"step":1,
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-coupon"
},
"products":[
{
"name":"Panda_Antivirus",
"id":7628801,
"price":"200",
"quantity":2,
"type":"Electronic",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
],
"group": "General",
"tax": 20.5
},
{
"name":"Turbo_Panda_Antivirus",
"id":7630067,
"price":"100",
"quantity":1,
"type":"Electronic",
"group": "General",
"tax": 20.5
}
]
}
}
}
``` |
| **purchase** | PLACE_ORDER (place-order:success) | - the actionField’s id key is the order’s refNo hashed with sha256<br>- the actionField’s revenue key is the order’s gross discounted price<br>- the actionField’s purchaseFlow key references purchase flow selected by the customer (personal/company)<br>- the actionField’s affiliation key is only present if the order has an affiliate<br>- many other optional keys (coupon, returnType, returnUrl, subscription, etc.) are present only when relevant<br>- product-specific keys: coupon, price (net discounted price), isDynamic/dynamicType/dynamicRecurrence, hiddenAdditionalFields, options | ```json
{
"event":"purchase",
"ecommerce":{
"purchase":{
"currencyCode":"USD",
"actionField":{
"id":"11544394",
"affiliation":"",
"revenue":"168.06",
"tax":"31.94",
"shipping":"0",
"purchaseFlow":"personal",
"returnUrl":"",
"returnType":"",
"coupon":"",
"subscription":"",
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-coupon"
},
"products":[
{
"name":"Panda_Antivirus",
"id":7628801,
"price":"84.03",
"quantity":1,
"type":"Electronic",
"coupon":"coupon_code",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
],
"group": "General",
"tax": 20.5
},
{
"name":"Turbo_Panda_Antivirus",
"id":7630067,
"price":"84.03",
"quantity":1,
"type":"Electronic",
"isDynamic":true,
"dynamicType":"",
"dynamicRecurrence":"",
"dynamicDuration":"dynamicRenewalPrice"
}
]
}
}
}
``` |
| **removeFromCart** | DELETE_ITEM (delete-item) | - the product’s coupon key is only present if there is an active product coupon code (coupon / auto-apply)<br>- the product’s price is the item’s net discounted price<br>- dynamic product keys present only if product is dynamic<br>- product’s hiddenAdditionalFields present only if the product has hidden fields<br>- options present only if product has active options<br>- remove actionField coupon & orderDiscountCoupon present only when valid order promotion exists (defaults to 'auto-apply') | ```json
{
"event":"removeFromCart",
"ecommerce":{
"currencyCode":"USD",
"remove":{
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-coupon",
"products":[
{
"name":"Turbo_Panda_Antivirus",
"id":7630067,
"price":"100",
"quantity":1,
"type":"Electronic",
"coupon":"coupon_code",
"isDynamic":true,
"dynamicType":"",
"dynamicRecurrence":"",
"dynamicDuration":"",
"dynamicRenewalPrice":"",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
]
}
]
}
}
}
``` |
| **addToCart** | ADD_ITEM (add-item) | - the product’s coupon key is only present if there is an active product coupon code (coupon / auto-apply)<br>- the product’s price is the item’s net discounted price<br>- dynamic product keys present only if product is dynamic<br>- hiddenAdditionalFields & options present only when applicable | ```json
{
"event":"addToCart",
"currencyCode":"USD",
"ecommerce":{
"add":{
"products":[
{
"name":"Antivirus 2018 - physical product",
"id":7605582,
"price":"127.89",
"quantity":1,
"type":"Physical",
"coupon":"coupon_code",
"isDynamic":true,
"dynamicType":"",
"dynamicRecurrence":"",
"dynamicDuration":"",
"dynamicRenewalPrice":"",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
]
}
]
}
}
}
``` |
### Google Tag Manager with GA4
Google Tag Manager GA4 respects the Google Analytics 4 structure. The DataLayer is an array of objects. The object payload passed to the DataLayer is mainly composed of two keys: event & ecommerce.
The event key determines the type of event passed to the Datalayer, while the ecommerce key holds the eCommerce object with all the relevant event data.
| Event | Triggered by | Notes | Example |
| --- | --- | --- | --- |
| **begin_checkout** | LOAD_CART (load-cart)<br>SET_ECOMMERCE (set-ecommerce) | - the actionField’s step will always be 1 for the checkout page<br>- the item’s price key is the item’s net discounted price<br>- the item’s hiddenAdditionalFields key is only present if the product has hidden additional fields<br>- the item’s options key is only present if the product has active options<br>- the actionField’s coupon key is only present if there is a valid order promotion present<br>- the actionField’s orderDiscountCoupon key is only present if there is a valid order promotion present (defaults to 'auto-apply') | ```json
{
"event": "begin_checkout",
"ecommerce": {
"currency": "USD",
"value": "300",
"coupon": "promotion-code",
"actionField": {
"step": 1,
"orderDiscountCoupon": "promotion-coupon"
},
"items": [
{
"item_name": "Panda_Antivirus",
"item_id": 7628801,
"price": "200",
"quantity": 2,
"type": "Electronic",
"options": "USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields": [
{
"product_hidden_text_name": "hidden_text_value"
}
],
"group": "General",
"tax": 20.5
},
{
"item_name": "Turbo_Panda_Antivirus",
"item_id": 7630067,
"price": "100",
"quantity": 1,
"type": "Electronic",
"group": "General",
"tax": 20.5
}
]
}
}
``` |
| **purchase** | PLACE_ORDER (place-order:success) | - the transaction_id key is the order’s refNo hashed with sha256<br>- the value key is the order’s gross discounted price<br>- various actionField keys present only when applicable (purchaseFlow, affiliation, coupon, returnType/returnUrl, subscription, orderDiscountCoupon etc.)<br>- item keys: coupon, price (net discounted), dynamic keys, hiddenAdditionalFields, options | ```json
{
"event": "purchase",
"ecommerce": {
"coupon": "promotion-code",
"currency": "USD",
"value": "168.06",
"shipping": "0",
"tax": "31.94",
"transaction_id": "8c7be1b402d775f256289410d608e47135f4c431d8064005fcbbc8b65ffeaaa5",
"actionField": {
"affiliation": "",
"purchaseFlow": "personal",
"returnUrl": "",
"returnType": "",
"subscription": "",
"orderDiscountCoupon": "promotion-coupon"
},
"items": [
{
"item_name": "Panda_Antivirus",
"item_id": 7628801,
"price": "84.03",
"quantity": 1,
"type": "Electronic",
"coupon": "coupon_code",
"options": "USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields": [
{
"product_hidden_text_name": "hidden_text_value"
}
],
"group": "General",
"tax": 20.5
},
{
"item_name": "Turbo_Panda_Antivirus",
"item_id": 7630067,
"price": "84.03",
"quantity": 1,
"type": "Electronic",
"isDynamic": true,
"dynamicType": "",
"dynamicRecurrence": "",
"dynamicDuration": "dynamicRenewalPrice"
}
]
}
}
``` |
| **remove_from_cart** | DELETE_ITEM (delete-item) | - the coupon key is only present if there is an active product coupon code<br>- the item’s price is the item’s net discounted price<br>- dynamic keys and hiddenAdditionalFields present only when applicable<br>- orderDiscountCoupon defaults to 'auto-apply' if promotion has no coupon | ```json
{
"event": "remove_from_cart",
"ecommerce": {
"currency": "USD",
"value": "100",
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-poupon",
"items": [
{
"item_name": "Turbo_Panda_Antivirus",
"item_id": 7630067,
"price": "100",
"quantity": 1,
"type": "Electronic",
"coupon": "coupon_code",
"isDynamic": true,
"dynamicType": "",
"dynamicRecurrence": "",
"dynamicDuration": "",
"dynamicRenewalPrice": "",
"options": "USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields": [
{
"product_hidden_text_name": "hidden_text_value"
}
]
}
]
}
}
``` |
| **add_to_cart** | ADD_ITEM (add-item) | - item coupon key only present if active product coupon code<br>- item price is net discounted price<br>- dynamic keys, hiddenAdditionalFields, options present only when applicable | ```json
{
"event": "add_to_cart",
"ecommerce": {
"currency": "USD",
"value": "127.89",
"items": [
{
"item_name": "Antivirus 2018 - physical product",
"item_id": 7605582,
"price": "127.89",
"quantity": 1,
"type": "Physical",
"coupon": "coupon_code",
"isDynamic": true,
"dynamicType": "",
"dynamicRecurrence": "",
"dynamicDuration": "",
"dynamicRenewalPrice": "",
"options": "USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields": [
{
"product_hidden_text_name": "hidden_text_value"
}
]
}
]
}
}
``` |
| **view_item_list** | LOAD_CROSS_SELL (load-cross-sell) | - the item’s price is the net discounted price<br>- the item's index key is the position of the product in the cross-sell listing | ```json
{
"event": "view_item_list",
"ecommerce": {
"currency": "USD",
"item_list_id": "cross-sell products",
"item_list_name": "cross-sell products",
"items": [
{
"item_name": "Printer 2",
"item_id": 31002340,
"price": "20",
"discount": "0",
"type": "Physical",
"group": null,
"tax": 0,
"format": "cross_sell",
"index": 0
},
{
"item_name": "Demo 1",
"item_id": 31016005,
"price": "12.12",
"discount": "0",
"type": "Electronic",
"group": null,
"tax": 0,
"format": "cross_sell",
"index": 1
}
]
}
}
``` |
### Adobe's Dynamic Tag Manager
The layout is the same advanced eCommerce layout as GTM/UA in structure; payload keys are similar and many product/actionField keys are optional and present only when relevant.
| Event | Triggered by | Notes | Example |
| --- | --- | --- | --- |
| **checkout** | - LOAD_CART (load-cart)<br>- SET_ECOMMERCE (set-ecommerce) | - actionField.step is always 1 for checkout<br>- actionField coupon & orderDiscountCoupon present only when applicable (orderDiscountCoupon defaults to 'auto-apply')<br>- item price is net discounted price<br>- hiddenAdditionalFields & options present only when applicable<br>- product externalRef present only if product has external reference | ```json
{
"event":"checkout",
"ecommerce":{
"currencyCode":"USD",
"checkout":{
"actionField":{
"step":1,
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-coupon"
},
"products":[
{
"name":"Panda_Antivirus",
"id":7628801,
"price":"200",
"quantity":2,
"type":"Electronic",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
],
"externalRef": "",
"group": "General",
"tax": 20.5
},
{
"name":"Turbo_Panda_Antivirus",
"id":7630067,
"price":"100",
"quantity":1,
"type":"Electronic",
"group": "General",
"tax": 20.5
}
]
}
}
}
``` |
| **purchase** | PLACE_ORDER (place-order:success) | - actionField.id is the order’s refNo hashed with sha256<br>- actionField.revenue is the order’s gross discounted price<br>- purchaseFlow, affiliation, coupon, returnType/returnUrl, subscription fields present when applicable<br>- many product-specific optional keys (coupon, dynamic keys, hiddenAdditionalFields, options, externalRef) | ```json
{
"event":"purchase",
"ecommerce":{
"purchase":{
"currencyCode":"USD",
"actionField":{
"id":"11544394",
"affiliation":"",
"revenue":"168.06",
"tax":"31.94",
"shipping":"0",
"purchaseFlow":"personal",
"returnUrl":"",
"returnType":"",
"coupon":"",
"subscription":"",
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-coupon"
},
"products":[
{
"name":"Panda_Antivirus",
"id":7628801,
"price":"84.03",
"quantity":1,
"type":"Electronic",
"coupon":"coupon_code",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
],
"externalRef": "",
"group": "General",
"tax": 20.5
},
{
"name":"Turbo_Panda_Antivirus",
"id":7630067,
"price":"84.03",
"quantity":1,
"type":"Electronic",
"isDynamic":true,
"dynamicType":"",
"dynamicRecurrence":"",
"dynamicDuration":"dynamicRenewalPrice",
"externalRef": "",
"group": "General",
"tax": 20.5
}
]
}
}
}
``` |
| **removeFromCart** | DELETE_ITEM (delete-item) | - product coupon key only present if active product coupon code<br>- price is net discounted price<br>- dynamic keys, hiddenAdditionalFields, options, externalRef present only when applicable<br>- remove actionField coupon & orderDiscountCoupon present only when applicable (defaults to 'auto-apply') | ```json
{
"event":"removeFromCart",
"ecommerce":{
"currencyCode":"USD",
"remove":{
"coupon": "promotion-code",
"orderDiscountCoupon": "promotion-coupon",
"products":[
{
"name":"Turbo_Panda_Antivirus",
"id":7630067,
"price":"100",
"quantity":1,
"type":"Electronic",
"coupon":"coupon_code",
"isDynamic":true,
"dynamicType":"",
"dynamicRecurrence":"",
"dynamicDuration":"",
"dynamicRenewalPrice":"",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
],
"externalRef": ""
}
]
}
}
}
``` |
| **addToCart** | ADD_ITEM (add-item) | - product coupon key only present if active product coupon code<br>- price is net discounted price<br>- dynamic keys, hiddenAdditionalFields, options, externalRef present only when applicable | ```json
{
"event":"addToCart",
"currencyCode":"USD",
"ecommerce":{
"add":{
"products":[
{
"name":"Antivirus 2018 - physical product",
"id":7605582,
"price":"127.89",
"quantity":1,
"type":"Physical",
"coupon":"coupon_code",
"isDynamic":true,
"dynamicType":"",
"dynamicRecurrence":"",
"dynamicDuration":"",
"dynamicRenewalPrice":"",
"options":"USERS=users_one_test;PERIOD=period_one",
"hiddenAdditionalFields":[
{
"product_hidden_text_name":"hidden_text_value"
}
],
"externalRef": ""
}
]
}
}
}
``` |
## Custom events (cartUpdated)
Some Web Metric solutions allow the use of custom events. Currently, these solutions are Adobe’s Dynamic Tag Manager and Google Tag Manager.
Custom events allow passing any values under any keys in a consistent format.
The format of a custom event is as follows:
```json
{
"event": "cartUpdated",
"CUSTOM_KEY_1": "custom_value_1",
"CUSTOM_KEY_2": "custom_value_2",
...
}