The SDK works the fashion of Google Tag Manager. An array “quanticEvents” is used:
window.quanticEvents = window.quanticEvents || []; // get or set the array in the global context
window.quanticEvents.push(
{
// event goes here
}
);
Here is a small example:
window.quanticEvents = window.quanticEvents || []; // get or set the array in the global context
window.quanticEvents.push({
"event": "add_to_cart",
"data": {
"cart": {
"id": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"totalQuantity": 1,
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"lines": [
{
"merchandise": {
"id": "FJ4241-001-Noir-41",
}
}
]
}
}
})
Accepted events
We currently have:
cart_update
To send a complete, updated cart
add_to_cart
Add an item to cart
remove_from_cart
Remove an item from cart
Setup
If you are out of shopify, just add our tag before </head>
<script async src="https://storage.googleapis.com/quanticfyscripts01/quantag/script.js"></script>
Event: cart_update
Overview
The Cart represents a customer's shopping cart, containing details about the items they intend to purchase, including costs, quantities, product information, and attributes. This document provides a structured breakdown of the Cart and its related objects.
When receiving multiple cart_update events for the same visitor, Quantic will only keep the last one.
This event is the one we like the best, if you can use this one.
Reference
Required properties are flagged with *. Strongly recommended properties are flagged with *.
Filling all properties will allow Quantic to send high quality events to your CRM and enable you to build the best abandon-recovering templates with stock warnings for FOMO, discounts, product reviews,...
Cart Object
The Cart object contains the following properties:
Attributes
Type: Attribute[]
Description: List of attributes associated with the cart
Cost
Type: CartCost
Description: Estimated total cost the customer will pay at checkout.
ID *
Type: string
Description: Globally unique identifier for the cart.
Token *
Type: string
Description: Unique token for the cart.
Lines *
Type: CartLine[]
Description: List of cart lines containing details about items the customer intends to purchase.
Total Quantity
Type: number
Description: Total number of items in the cart.
CartLine Object
Each CartLine represents an individual item in the cart.
Cost *
Type: CartCost
Description: Total cost of the merchandise line, which may change at checkout.
Merchandise *
Type: ProductVariant
Description: The specific product variant the customer intends to purchase.
Quantity *
Type: number
Description: Number of units of the product variant added to the cart.
Attributes
Type: Attribute[]
Description: List of attributes associated with the CartLine
CartCost Object
The CartLineCost object provides cost details for a single line item.
Total Amount *
Type: Money
Description: Total cost of the merchandise line.
ProductVariant Object
Represents a specific variation of a product.
ID *
Type: string | null
Description: Globally unique identifier for the product variant.
Image *
Type: Image | null
Description: Image associated with the product variant.
Price *
Type: MoneyV2
Description: Current price of the product variant.
MSRP *
Type: MoneyV2
Description: Manufacturer's Suggested Retail Price of the product variant, useful to display discounts
Product *
Type: Product
Description: Parent product this variant belongs to.
SKU *
Type: string | null
Description: Stock Keeping Unit (SKU) assigned to the variant.
Stock *
Type: int | null
Description: Remaining quantity of the variant
Title *
Type: string | null
Description: Title of the product variant in the user’s locale.
Untranslated Title *
Type: string | null
Description: Untranslated title of the product variant.
Attributes
Type: Attribute[]
Description: List of extra attributes associated with the product variant
Product Object
Contains details about a specific product.
ID *
Type: string | null
Description: Globally unique identifier for the product.
Title *
Type: string
Description: Product’s title.
Type *
Type: string | null
Description: Product type specified by the merchant.
Untranslated Title *
Type: string | null
Description: Untranslated title of the product.
URL *
Type: string | null
Description: Relative URL of the product.
Vendor
Type: string
Description: Vendor name of the product.
Attributes
Type: Attribute[]
Description: List of extra attributes associated with the product
Money Object
Represents monetary values.
Amount
Type: string
Description: Amount in decimal format.
Currency Code
Type: string
Description: Currency of the amount , ISO 4217 codes (e.g., USD, EUR).
Image Object
The image object represents the products featured image
src
Type: string | null
Description: The location of the image as a URL.
Usage
To send an cart_update event:
window.quanticEvents.push({
"event": "cart_update",
"data": {
"cart": {
"id": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"token": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"totalQuantity": 1,
"attributes": [
{
"color": "Noir",
"reviewCount": "5",
"reviewRating": "4.6",
}
],
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"lines": [
{
"merchandise": {
"id": "FJ4241-001-Noir-41",
"image": {
"src": "https://static.nike.com/a/images/t_PDP_1728_v1/f_auto,q_auto:eco/a35668b9-1a1a-48fe-892b-4151c86cf914/JA+1+ASW.png"
},
"price": {
"amount": 139.99,
"currencyCode": "EUR"
},
"msrp": {
"amount": 139.99,
"currencyCode": "EUR"
},
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"product": {
"id": "FJ4241-001",
"title": "JA 1 ASW",
"type": "Chaussure de basket",
"untranslatedTitle": "JA 1 ASW",
"url": "https://www.nike.com/fr/t/chaussure-de-basket-ja-1-asw-K505nl/FJ4241-001",
"vendor": "nike"
},
"sku": "FJ4241-001",
"stock": 20,
"title": "JA 1 ASW",
"untranslatedTitle": "JA 1 ASW"
}
}
]
}
}
})
Example body
{
"cart": {
"id": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"token": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"totalQuantity": 1,
"attributes": [
{
"color": "Noir",
"reviewCount": "5",
"reviewRating": "4.6",
}
],
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"lines": [
{
"merchandise": {
"id": "FJ4241-001-Noir-41",
"image": {
"src": "https://static.nike.com/a/images/t_PDP_1728_v1/f_auto,q_auto:eco/a35668b9-1a1a-48fe-892b-4151c86cf914/JA+1+ASW.png"
},
"price": {
"amount": 139.99,
"currencyCode": "EUR"
},
"msrp": {
"amount": 139.99,
"currencyCode": "EUR"
},
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"product": {
"id": "FJ4241-001",
"title": "JA 1 ASW",
"type": "Chaussure de basket",
"untranslatedTitle": "JA 1 ASW",
"url": "https://www.nike.com/fr/t/chaussure-de-basket-ja-1-asw-K505nl/FJ4241-001",
"vendor": "nike"
},
"sku": "FJ4241-001",
"stock": 20,
"title": "JA 1 ASW",
"untranslatedTitle": "JA 1 ASW"
}
}
]
}
}
Event: add_to_cart
Structure is the same but Quantic will add up these events and remove to remove_from_cart events to compute the whole cart
window.quanticEvents.push({
"event": "cart_update",
"data": {
"cart": {
"id": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"token": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"totalQuantity": 1,
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"lines": [
{
"merchandise": {
"id": "FJ4241-001-Noir-41",
"image": {
"src": "https://static.nike.com/a/images/t_PDP_1728_v1/f_auto,q_auto:eco/a35668b9-1a1a-48fe-892b-4151c86cf914/JA+1+ASW.png"
},
"price": {
"amount": 139.99,
"currencyCode": "EUR"
},
"msrp": {
"amount": 139.99,
"currencyCode": "EUR"
},
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"product": {
"id": "FJ4241-001",
"title": "JA 1 ASW",
"type": "Chaussure de basket",
"untranslatedTitle": "JA 1 ASW",
"url": "https://www.nike.com/fr/t/chaussure-de-basket-ja-1-asw-K505nl/FJ4241-001",
"vendor": "nike"
},
"sku": "FJ4241-001",
"stock": 20,
"title": "JA 1 ASW",
"untranslatedTitle": "JA 1 ASW",
"attributes": [
{
"color": "Noir",
"reviewCount": "5",
"reviewRating": "4.6",
}
]
}
}
]
}
}
})
Event: remove_from_cart
Structure is the same but Quantic will add up these events and remove to remove_from_cart events to compute the whole cart
window.quanticEvents.push({
"event": "cart_update",
"data": {
"cart": {
"id": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"token": "f0f4fa83-c09c-fac3-753f-25075fff40ef",
"lines": [
{
"merchandise": {
"id": "FJ4241-001-Noir-41",
"image": {
"src": "https://static.nike.com/a/images/t_PDP_1728_v1/f_auto,q_auto:eco/a35668b9-1a1a-48fe-892b-4151c86cf914/JA+1+ASW.png"
},
"price": {
"amount": 139.99,
"currencyCode": "EUR"
},
"msrp": {
"amount": 139.99,
"currencyCode": "EUR"
},
"cost": {
"totalAmount": {
"amount": 97.99,
"currencyCode": "EUR"
}
},
"product": {
"id": "FJ4241-001",
"title": "JA 1 ASW",
"type": "Chaussure de basket",
"untranslatedTitle": "JA 1 ASW",
"url": "https://www.nike.com/fr/t/chaussure-de-basket-ja-1-asw-K505nl/FJ4241-001",
"vendor": "nike"
},
"sku": "FJ4241-001",
"stock": 20,
"title": "JA 1 ASW",
"untranslatedTitle": "JA 1 ASW",
"attributes": [
{
"color": "Noir",
"reviewCount": "5",
"reviewRating": "4.6",
}
]
}
}
]
}
}
})
Cet article a-t-il été utile ?
C'est super !
Merci pour votre commentaire
Désolé ! Nous n'avons pas pu vous être utile
Merci pour votre commentaire
Commentaires envoyés
Nous apprécions vos efforts et nous allons corriger l'article