Custom JavaScript Variable within Google Tag Manager (ClientID, Document Title etc)




Let us explore how to use the Custom JavaScript Variable in Google Tag Manager accurately. This Variable is often used to extend the functionality of GTM beyond the provided methods of creating Variables. If you know JavaScript, you can easily input an anonymous function which will be executed when the Variable is checked. This allows for a far bigger range of Variables than before.

πŸ”— LINKS:

http://www.simoahava.com/analytics/macro-magic-google-tag-manager/
http://www.codecademy.com/tracks/javascript
Variable JS Template: http://pastebin.com/CAfeE48Y
πŸŽ“ Measure Masters Subscription: https://measureschool.com/products/measuremasters/

πŸ”€ GTM Copy Paste https://chrome.google.com/webstore/detail/gtm-copy-paste/mhhidgiahbopjapanmbflpkcecpciffa

πŸš€ Hire us: https://measureschool.com/services/

πŸ“š Recommended Measure Books: https://kit.com/Measureschool/recommended-measure-books

πŸ“· Gear we used to produce this video: https://kit.com/Measureschool/measureschool-youtube-gear

πŸ‘ FOLLOW US
Facebook: http://www.facebook.com/measureschool
Twitter: http://www.twitter.com/measureschool
LinkedIn: https://www.linkedin.com/company/measureschool

Original source


13 responses to “Custom JavaScript Variable within Google Tag Manager (ClientID, Document Title etc)”

  1. can we do some sort of tracking for dynamic outbound links? For example, if you have a landing page with third-party content from CNN News website integrated via iframe. Would this work via the Tag Manager, can the Tag Manager be configured so it captures part of the link which is the main url followed by news category?

  2. Why do I get an object-like result for clientId? Like this: '%252525252525252525252525252525252525252525252525252525252525252525252525252525
    255Bobject%252525252525252525252525252525252525252525252525252525252525252525252
    5252525252520Object%252525252525252525252525252525252525252525252525252525252525
    252525252525252525255D'

  3. Hello Julian! thanks again for course! could you please help to advise how to track which variant user added to cart? i use DuracellTomy plugin for wordpress, but it seems that i need to create a new variable to record Variant value when user clicks AddtoCart. Probably you come across examples in the past?
    Any advice will be truly appreciated! πŸ™‚

  4. thanks for a very good tut.
    – When we need to use a custom HTML tag and custom Javascript tag. I confuse them and their purpose in order to use in right thing.
    – For example:
    + I have a case "Sign Up" form which has checkbox "subscribe newsletter"
    + So in this case, I need to use custom JS tag or custom HTML tag

Leave a Reply