From the course: Learning Google Tag Manager

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Incorporating custom JavaScript into GTM variables

Incorporating custom JavaScript into GTM variables - Google Tag Manager Tutorial

From the course: Learning Google Tag Manager

Start my 1-month free trial

Incorporating custom JavaScript into GTM variables

- [Instructor] So in the last video, we saw how we can actually interact in real time with existing JavaScript on the page through tag manager. In this example, I want to take it even further and show you how you can utilize custom JavaScript that we write and push right in GTM. Now there's so much information we can extract through JavaScript, and it's really useful. In fact, all the data that Google analytics extracts and sends back is done via JavaScript. And it's really the root of tag manager as well. So we talked about the example earlier of being able to grab and store the local time on the user's browser and store that as a variable that we could send back to Google analytics as a custom dimension. Well, let's go ahead and do that example. Head on down here to our workspace into variables go to the bottom and we are going to set up a new custom variable of type custom JavaScript. This is going to effectively give us…

Contents