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)”
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.
Regards
Xavier
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.
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?
Why do I get an object-like result for clientId? Like this: '%252525252525252525252525252525252525252525252525252525252525252525252525252525
255Bobject%252525252525252525252525252525252525252525252525252525252525252525252
5252525252520Object%252525252525252525252525252525252525252525252525252525252525
252525252525252525255D'
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!
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! π
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?
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!
thanks a lot
thank you so much sir, have any option to put Adsense code in gtm bcoz my blog is page speed more
Hi Julian,
i'm tracking button "submit chat" on livechat ticket but that button have no class, id,… Can you help me, please
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
How can I render the custom variable inside of my console?