Created
August 1, 2023 10:48
-
-
Save stefanatcroud/dd5eecbbfd513e62bd1e31371b904521 to your computer and use it in GitHub Desktop.
Script for GTM to use in a Custom JavaScript variable that returns a vertical bar separated list of item.id's taken from GA4 ecommerce data layer
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
function () { | |
return google_tag_manager[{{Container ID}}].dataLayer.get("ecommerce.items").map(function(a){return a.item_id}).join("|") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment