-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpurchase
38 lines (38 loc) · 2 KB
/
purchase
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
dataLayer.push({
event: "purchase", // name of the event. In this case, it always must be purchase
ecommerce: {
currency: 'USD', // required
value: 3597.00, // required - order total (price of all products + shipping)
tax: 3.00, // optional - tax
transaction_id: 'abc123', // required - transaction id
coupon: 'ENDOFSUMMER', // optional - if coupon was applied to the order, include it here
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
},{
item_id: "SKU_12345",
item_name: "3.9GHz 6-Core 5600G AMD Ryzen",
item_brand: "Intel",
item_category: "Dedicated",
item_category2: "Instant Dedicated Servers",
item_category3: "cat3",
item_category4: "cat4",
item_category5: "cat5",
item_variant: "variant",
price: 9.99,
quantity: 1
}
]
}
});