Advertisement
prabapro

EEC - Purchase

Jan 26th, 2021 (edited)
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. // Send transaction data with a pageview if available
  3. // when the page loads. Otherwise, use an event when the transaction
  4. // data becomes available.
  5. window.dataLayer = window.dataLayer || [];
  6. window.dataLayer.push({
  7.   event: 'eec.purchase',
  8.   'ecommerce': {
  9.     'purchase': {
  10.       'actionField': {
  11.         'id': 'T12345',                         // Transaction ID. Required for purchases and refunds.
  12.         'affiliation': 'Online Store',
  13.         'revenue': '35.43',                     // Total transaction value (incl. tax and shipping)
  14.         'tax':'4.90',
  15.         'shipping': '5.99',
  16.         'coupon': 'SUMMER_SALE'
  17.       },
  18.       'products': [{                            // List of productFieldObjects.
  19.         'name': 'Triblend Android T-Shirt',     // Name or ID is required.
  20.         'id': '12345',
  21.         'price': '15.25',
  22.         'brand': 'Google',
  23.         'category': 'Apparel',
  24.         'variant': 'Gray',
  25.         'quantity': 1,
  26.         'coupon': ''                            // Optional fields may be omitted or set to empty string.
  27.        },
  28.        {
  29.         'name': 'Donut Friday Scented T-Shirt',
  30.         'id': '67890',
  31.         'price': '33.75',
  32.         'brand': 'Google',
  33.         'category': 'Apparel',
  34.         'variant': 'Black',
  35.         'quantity': 1
  36.        }]
  37.     }
  38.   }
  39. });
  40. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement