fork download
  1. (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  2.  
  3. new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  4.  
  5. j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  6.  
  7. 'https://w...content-available-to-author-only...r.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  8.  
  9. })(window,document,'script','dataLayer','GTM-5QB99HZR');
  10.  
  11. gtag('consent', 'update', {
  12. 'ad_storage': 'granted',
  13. 'analytics_storage': 'granted',
  14. 'ad_user_data': 'granted',
  15. 'ad_personalization': 'granted',
  16. });
  17.  
  18. analytics.subscribe('page_viewed', (event) => {
  19. window.dataLayer.push({
  20. 'event': 'page_viewed',
  21. 'page_location': event.context.window.location.href,
  22. 'page_title': event.context.document.title,
  23. });
  24.  
  25. analytics.subscribe("product_viewed", (event) => {
  26. window.dataLayer.push({
  27. event: "product_viewed",
  28. timestamp: event.timestamp,
  29. id: event.id,
  30. url: event.context.document.location.href,
  31. product_id: event.data?.productVariant?.product?.id,
  32. product_title: event.data?.productVariant?.title,
  33. product_sku: event.data?.productVariant?.sku,
  34. });
  35. });
  36.  
  37. analytics.subscribe("collection_viewed", (event) => {
  38. window.dataLayer.push({
  39. event: "collection_viewed",
  40. timestamp: event.timestamp,
  41. id: event.id,
  42. client_id: event.clientId,
  43. url: event.context.document.location.href,
  44. collection_id: event.data?.collection?.id,
  45. collection_title: event.data?.collection?.title,
  46. });
  47. });
  48.  
  49. analytics.subscribe("product_added_to_cart", (event) => {
  50. window.dataLayer.push({
  51. event: "product_added_to_cart",
  52. timestamp: event.timestamp,
  53. id: event.id,
  54. price: event.data?.cartLine?.merchandise?.price?.amount,
  55. currency: event.data?.cartLine?.merchandise?.id,
  56. product_title: event.data?.cartLine?.merchandise?.product?.title,
  57. quantity: event.data?.cartLine?.quantity,
  58. total_cost: event.data?.cartLine?.cost?.totalAmount?.amount,
  59. });
  60. });
  61.  
  62. analytics.subscribe("checkout_started", (event) => {
  63. window.dataLayer.push({
  64. event: "checkout_started",
  65. timestamp: event.timestamp,
  66. id: event.id,
  67. orderId: event.data?.checkout?.order?.id,
  68. currency: event.data?.checkout?.currencyCode,
  69. subtotal: event.data?.checkout?.subtotalPrice?.amount,
  70. value: event.data?.checkout?.totalPrice?.amount,
  71. tax: event.data?.checkout?.totalTax?.amount,
  72. });
  73.  
  74. analytics.subscribe("checkout_completed", (event) => {
  75. window.dataLayer.push({
  76. event: "checkout_started",
  77. timestamp: event.timestamp,
  78. id: event.id,
  79. client_id: event.clientId,
  80. email: event.data?.checkout?.email,
  81. phone: event.data?.checkout?.phone,
  82. first_name: event.data?.checkout?.shippingAddress?.firstName,
  83. last_name: event.data?.checkout?.shippingAddress?.lastName,
  84. address1: event.data?.checkout?.shippingAddress?.address1,
  85. address2: event.data?.checkout?.shippingAddress?.address2,
  86. city: event.data?.checkout?.shippingAddress?.city,
  87. country: event.data?.checkout?.shippingAddress?.country,
  88. countryCode: event.data?.checkout?.shippingAddress?.countryCode,
  89. province: event.data?.checkout?.shippingAddress?.province,
  90. provinceCode: event.data?.checkout?.shippingAddress?.provinceCode,
  91. zip: event.data?.checkout?.shippingAddress?.zip,
  92. orderId: event.data?.checkout?.order?.id,
  93. currency: event.data?.checkout?.currencyCode,
  94. subtotal: event.data?.checkout?.subtotalPrice?.amount,
  95. value: event.data?.checkout?.totalPrice?.amount,
  96. tax: event.data?.checkout?.totalTax?.amount,
  97. });
  98.  
  99. analytics.subscribe("payment_info_submitted", (event) => {
  100. window.dataLayer.push({
  101. event: "payment_info_submitted",
  102. timestamp: event.timestamp,
  103. id: event.id,
  104. email: event.data?.checkout?.email,
  105. phone: event.data?.checkout?.phone,
  106. first_name: event.data?.checkout?.shippingAddress?.firstName,
  107. last_name: event.data?.checkout?.shippingAddress?.lastName,
  108. address1: event.data?.checkout?.shippingAddress?.address1,
  109. address2: event.data?.checkout?.shippingAddress?.address2,
  110. city: event.data?.checkout?.shippingAddress?.city,
  111. country: event.data?.checkout?.shippingAddress?.country,
  112. countryCode: event.data?.checkout?.shippingAddress?.countryCode,
  113. province: event.data?.checkout?.shippingAddress?.province,
  114. provinceCode: event.data?.checkout?.shippingAddress?.provinceCode,
  115. zip: event.data?.checkout?.shippingAddress?.zip,
  116. orderId: event.data?.checkout?.order?.id,
  117. currency: event.data?.checkout?.currencyCode,
  118. subtotal: event.data?.checkout?.subtotalPrice?.amount,
  119. shipping: event.data?.checkout?.shippingLine?.price?.amount,
  120. value: event.data?.checkout?.totalPrice?.amount,
  121. tax: event.data?.checkout?.totalTax?.amount,
  122. });
  123. });
Success #stdin #stdout 0.04s 25280KB
stdin
Standard input is empty
stdout
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
 
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
 
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
 
'https://w...content-available-to-author-only...r.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
 
})(window,document,'script','dataLayer','GTM-5QB99HZR');
 
gtag('consent', 'update', { 
  'ad_storage': 'granted', 
  'analytics_storage': 'granted', 
  'ad_user_data': 'granted', 
  'ad_personalization': 'granted', 
});
 
analytics.subscribe('page_viewed', (event) => { 
  window.dataLayer.push({ 
   'event': 'page_viewed', 
   'page_location': event.context.window.location.href, 
   'page_title': event.context.document.title, 
  });
 
analytics.subscribe("product_viewed", (event) => {
  window.dataLayer.push({
    event: "product_viewed",
    timestamp: event.timestamp,
    id: event.id,
    url: event.context.document.location.href,
    product_id: event.data?.productVariant?.product?.id,
    product_title: event.data?.productVariant?.title,
    product_sku: event.data?.productVariant?.sku,
  });
});
 
analytics.subscribe("collection_viewed", (event) => {
  window.dataLayer.push({
    event: "collection_viewed",
    timestamp: event.timestamp,
    id: event.id,
    client_id: event.clientId,
    url: event.context.document.location.href,
    collection_id: event.data?.collection?.id,
    collection_title: event.data?.collection?.title,
  });
});
 
analytics.subscribe("product_added_to_cart", (event) => {
  window.dataLayer.push({
    event: "product_added_to_cart",
    timestamp: event.timestamp,
    id: event.id,
    price: event.data?.cartLine?.merchandise?.price?.amount,
    currency: event.data?.cartLine?.merchandise?.id,
    product_title: event.data?.cartLine?.merchandise?.product?.title,
    quantity: event.data?.cartLine?.quantity,
    total_cost: event.data?.cartLine?.cost?.totalAmount?.amount,
  });
});
 
analytics.subscribe("checkout_started", (event) => {
  window.dataLayer.push({
    event: "checkout_started",
    timestamp: event.timestamp,
    id: event.id,
    orderId: event.data?.checkout?.order?.id,
    currency: event.data?.checkout?.currencyCode,
    subtotal: event.data?.checkout?.subtotalPrice?.amount,
    value: event.data?.checkout?.totalPrice?.amount,
    tax: event.data?.checkout?.totalTax?.amount,
  });
 
analytics.subscribe("checkout_completed", (event) => {
  window.dataLayer.push({
    event: "checkout_started",
    timestamp: event.timestamp,
    id: event.id,
    client_id: event.clientId,
    email: event.data?.checkout?.email,
    phone: event.data?.checkout?.phone,
    first_name: event.data?.checkout?.shippingAddress?.firstName,
    last_name: event.data?.checkout?.shippingAddress?.lastName,
    address1: event.data?.checkout?.shippingAddress?.address1,
    address2: event.data?.checkout?.shippingAddress?.address2,
    city: event.data?.checkout?.shippingAddress?.city,
    country: event.data?.checkout?.shippingAddress?.country,
    countryCode: event.data?.checkout?.shippingAddress?.countryCode,
    province: event.data?.checkout?.shippingAddress?.province,
    provinceCode: event.data?.checkout?.shippingAddress?.provinceCode,
    zip: event.data?.checkout?.shippingAddress?.zip,
    orderId: event.data?.checkout?.order?.id,
    currency: event.data?.checkout?.currencyCode,
    subtotal: event.data?.checkout?.subtotalPrice?.amount,
    value: event.data?.checkout?.totalPrice?.amount,
    tax: event.data?.checkout?.totalTax?.amount,
  });
 
analytics.subscribe("payment_info_submitted", (event) => {
  window.dataLayer.push({
    event: "payment_info_submitted",
    timestamp: event.timestamp,
    id: event.id,
    email: event.data?.checkout?.email,
    phone: event.data?.checkout?.phone,
    first_name: event.data?.checkout?.shippingAddress?.firstName,
    last_name: event.data?.checkout?.shippingAddress?.lastName,
    address1: event.data?.checkout?.shippingAddress?.address1,
    address2: event.data?.checkout?.shippingAddress?.address2,
    city: event.data?.checkout?.shippingAddress?.city,
    country: event.data?.checkout?.shippingAddress?.country,
    countryCode: event.data?.checkout?.shippingAddress?.countryCode,
    province: event.data?.checkout?.shippingAddress?.province,
    provinceCode: event.data?.checkout?.shippingAddress?.provinceCode,
    zip: event.data?.checkout?.shippingAddress?.zip,
    orderId: event.data?.checkout?.order?.id,
    currency: event.data?.checkout?.currencyCode,
    subtotal: event.data?.checkout?.subtotalPrice?.amount,
    shipping: event.data?.checkout?.shippingLine?.price?.amount,
    value: event.data?.checkout?.totalPrice?.amount,
    tax: event.data?.checkout?.totalTax?.amount,
  });
});