-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_to_cart
23 lines (23 loc) · 1.48 KB
/
add_to_cart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
dataLayer.push({
event: "add_to_cart", // name of the event. In this case, it always must be add_to_cart
ecommerce: {
currency: 'USD', // required
value: 3597.00, // required - order total (price of all products + shipping)
items: [ // an array with a product
{
item_id: "SKU_12345", // insert an actual product ID - One of item_id or item_name is required.
item_name: "3.9GHz 6-Core 5600G AMD Ryzen", // insert an actual product name - One of item_id or item_name is required.
item_brand: "Intel", // optional - insert an actual product brand
item_category: "Dedicated", // optional - insert an actual product category - The category of the item. If used as part of a category hierarchy or taxonomy then this will be the first category.
item_category2: "Instant Dedicated Servers", // optional - insert an actual additional product category
item_category3: "cat3", // optional - if it is possible to drill down the categories
item_category4: "cat4", // optional - if it is possible to drill down the categories
item_category5: "cat5", // optional - if it is possible to drill down the categories
item_variant: "variant", // optional insert an actual product variant
price: 9.99, // optional - insert an actual product price. Number or a string. Don't include currency code
quantity: 1 // optional - insert an actual product quantity
}
]
}
});