Custom JavaScript variable in Google Tag Manager (+3 use cases)

preview_player
Показать описание
Even though you can achieve a lot in Google Tag Manager without coding, knowing JavaScript opens up a whole new level of possibilities. In this video, we'll take a look at a Custom JavaScript variable. Also, I will show you three use cases.

=== LINKS ===

⭐⭐ JavaScript for Google Tag Manager course ⭐⭐

📕 Free e-book: JavaScript for Google Tag Manager

✭✭ Code snippets used in this lesson: ✭✭

✭ Custom Dimensions in Google Analytics 4

✭ Event tracking with Google Analytics 4 and Google Tag Manager

✭ Content Groups in Google Analytics 4

✭ Extract a price from a page with Google Tag Manager

=== CONNECT WITH JULIUS & ANALYTICS MANIA ===

#googletagmanager #javascript
Рекомендации по теме
Комментарии
Автор

Just what I needed after forgetting that I need to add return in the end as well (7 PM should be good time to rest, not to work). Cheers

marinradovan
Автор

always amazing and FOCUSED -- thank you SO much

AffyBoy
Автор

You're really great, thank you. 👏👏👏

ozgurozencom
Автор

would be good for you to cover creating variable + tag templates -- it's not that big a jump from C.. JS --- and takes GTM to the next level -- after that --- doing more SS GTM ---since we mastered that it's been a BEAST for us -- doing so much -- especially when we use stape server (not affiliated)

AffyBoy
Автор

Great content 🎉 if possible please do create video on adobe analytics.

TejasviKiranVlog
Автор

Great content! I take it we'd want to set a session-level dimension for collecting Time Of Day, correct? That way, we'd get the split of sessions by morning, afternoon, evening etc.

jumpinjeffflash
Автор

What is the difference between “Custom JavaScript” and “JavaScript Variable” options in the choose variable type list? Seems like the JavaScript variable is very limited to access already defined JS in the global scope?

IzaiahSP
Автор

I need to send arguments to a function and I can't get it to work in GTM. Is it possible to do something like this?:

Variable
function(key, defaultValue) {
return {{Click Element}}.dataset[key] || defaultValue
}

Use:
{{datasetElement("gtmTitle", "defaultTitle")}}

This would prevent me from creating multiple equal variables to obtain data from an element's dataset. Maybe it's not possible.
Thanks for the help.

MaximilianoAlfonso-vi
visit shbcf.ru