Created
February 22, 2023 11:13
-
-
Save zguillez/8a20b4cebf811f132e6d7cdfc33c67ab to your computer and use it in GitHub Desktop.
Get variable from dataLayer event
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() { | |
for (var i=0; i<dataLayer.length; i++) { | |
if (dataLayer[i][0]==='event' && dataLayer[i][1]==='view_item') { | |
return dataLayer[i][2].items[0].id; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment