-
Troubleshooting Custom JavaScript Variables in Google Tag Manager
I’m trying to make a Custom JavaScript variable in Google Tag Manager. I need to find out if a specific word shows up in the body of the web pages’ code to help me sort out the subcategories. Here’s what I have so far:
function(){ {var hasStellar = (document.body); var result = /stellar/.test(hasStellar); return result}}
and I’ve used document.body like this:
".project-template-template-stellar-project.project-template-viewstem" + "plate-stellar-project.single.single-project.postid-20597.--nav-trans" + "parent.app-data.index-data.singular-data.s" + "ingle-data.single-project-data.single-project-data.template-stellar-project-data"
But, when I preview it, the Custom JavaScript Variable gives me ‘false’. If you know how to fix this, or a better approach, I’d love to hear it!!!
Log in to reply.