SHOW:
|
|
- or go back to the newest paste.
1 | window.dataLayer = window.dataLayer || []; | |
2 | window.dataLayer.push({ | |
3 | event: 'purchase', // name of the event. In this case, it always must be purchase | |
4 | userId: '123abc' // this should be replaced by actual user ID and cannot be PII e.g. email address or IP address | |
5 | ecommerce: { | |
6 | currency: 'PKR', | |
7 | value: 29.98, // order total (price of all products + shipping) | |
8 | tax: 3.00, // tax | |
9 | shipping: 5.00, // shipping costs | |
10 | transaction_id: 'abc123', // transaction id | |
11 | coupon: 'ENDOFSUMMER', // if coupon was applied to the order, include it here | |
12 | items: [{ // an array with all products | |
13 | item_name: 'Product 1', // insert an actual product name | |
14 | item_id: 'product1', // insert an actual product ID | |
15 | price: 11.99, // insert an actual product price. Number or a string. Don't include currency code | |
16 | item_brand: 'brand A', // insert an actual product price | |
17 | item_category: 'Apparel', // insert an actual product top-level category | |
18 | ||
19 | quantity: '1', // product quantity | |
20 | - | item_app: 'Shopcast' //if a product that appears is from the recommended products then Shopcast should appear here otherwise it should be emply |
20 | + | |
21 | - | item_model:'user_to_item' //if the product is from the recommended products then the respective model should come here i.e. user_to_item, item_to_item or top_rated |
21 | + | },{ |
22 | - | },{ |
22 | + | |
23 | item_id: 'product2', | |
24 | price: 12.99, | |
25 | item_brand: 'Brand B', | |
26 | item_category: 'Category B', | |
27 | item_variant: 'Yellow', | |
28 | quantity: '1' | |
29 | }] | |
30 | - | item_app: 'Shopcast' //if a product that appears is from the recommended products then Shopcast should appear here otherwise it should be empty |
30 | + | |
31 | - | |
31 | + | |
32 | - | item_model:'user_to_item' //if the product is from the recommended products then the respective model should come here i.e. user_to_item, item_to_item or top_rated |
32 | + | |
33 | - | |
33 | + | |
34 | }); |