• Monday , 6 April 2020

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

Code Canyon

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.


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

Facebook: http://www.facebook.com/measureschool
Twitter: http://www.twitter.com/measureschool
LinkedIn: https://www.linkedin.com/company/measureschool

Original source

3d Ocean

Related Posts


  1. Xavier MEUNIER
    September 3, 2019 at 16:22

    Hi there,
    Very interesting video !
    One question: Once I got the GA user Id in GTM, how could I please export/retreive that ID to my CRM reports or mailchimp lists?
    Thanks a lot.

  2. Kosta Ouzounidis
    September 3, 2019 at 16:22

    Hi Julian, thank you very much for this, it is a great help as always.
    I think it would be a good idea if you could do one more tutorial in regards to this GTM feature with some more advanced examples.

  3. Affiliate Network
    September 3, 2019 at 16:22

    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?

  4. Germán Rimoldi
    September 3, 2019 at 16:22

    Why do I get an object-like result for clientId? Like this: '%252525252525252525252525252525252525252525252525252525252525252525252525252525

  5. SEOlizzer
    September 3, 2019 at 16:22

    How can i fire a script what normally must be between head and head like this: <script type="text/javascript" src="//tracking.xxxxxxx.com/tracking.js"></script>

    I have tried per custom html, but it doesnt work!

  6. Art Kalinin
    September 3, 2019 at 16:22

    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! 🙂

  7. Imanuel Abraham
    September 3, 2019 at 16:22

    Hi, I wonder if I need to setup "Field to Set" for every event to get the event data for User ID view on GA?

  8. Art Kalinin
    September 3, 2019 at 16:22

    Hi Julian! very helpful series of trainings, thanks a lot!
    can you advise how i can create a trigger that would check if textfield contains anything or it is blank?
    thanks a lot!

  9. ESoragoto Luo
    September 3, 2019 at 16:22

    thanks a lot

  10. K Md
    September 3, 2019 at 16:22

    thank you so much sir, have any option to put Adsense code in gtm bcoz my blog is page speed more

  11. Trung Kỹ
    September 3, 2019 at 16:22

    Hi Julian,

    i'm tracking button "submit chat" on livechat ticket but that button have no class, id,… Can you help me, please

  12. hai nguyen ngoc
    September 3, 2019 at 16:22

    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

  13. Rene Escobar
    September 3, 2019 at 16:22

    How can I render the custom variable inside of my console?

Leave A Comment

You must be logged in to post a comment.