Last active
July 10, 2023 17:24
-
-
Save brablc/d3d1458e7ceed3e068b4 to your computer and use it in GitHub Desktop.
Shoptet GTM Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(':') | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2015-10-26