Skip to content

Instantly share code, notes, and snippets.

@brablc
Last active July 10, 2023 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save brablc/d3d1458e7ceed3e068b4 to your computer and use it in GitHub Desktop.
Save brablc/d3d1458e7ceed3e068b4 to your computer and use it in GitHub Desktop.
Shoptet GTM Example
var dataHelper = new DataLayerHelper(dataLayer);
// Page type is one of:
// checkout: cart, billingAndShipping, customerDetails, thankYou
// other: homepage, article, category, productDetail, section
var pageType = dataHelper.get('shoptet.pageType');
// On any page, you can check for content of cart.
// It contains pairs productCode => itemCount
var cart = dataHelper.get('shoptet.cart');
// Different page types have different data available
if (pageType == "productDetail") {
dataLayer.push({
// We show how to change delimiter if needed
'hierarchy' : dataHelper.get('shoptet.product.currentCategory').split(' \| ').join(':')
});
}
@brablc
Copy link
Author

brablc commented May 25, 2015

2015-05-25

  • shoptet.order.total now contains the full amount with tax and shipping
  • shoptet.order.shipping is a new field containing shipping with tax
  • shoptet.order.shippingTax is a new field containing shipping tax
  • shoptet.order.netto is a new field containing only price of items without tax (previous total)

@brablc
Copy link
Author

brablc commented Jun 23, 2015

2015-06-23

  • added shoptet.cart (on all page types when cart is not empty)
  • added shoptet.product.code or shoptet.product.codes containing the code of the product (or product variants) on productDetail page

@brablc
Copy link
Author

brablc commented Oct 22, 2015

2015-10-26

  • Google Analytics Ecommerce variables are now automatically included on conversion page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment