Adding Custom User Engagement Timers in Google Tag Manager
how do we marketing fans And welcome back in the previous section, we learned how to add a custom container into google tag manager that allows us to track how far down on the page a user scrolls, that's one element of user engagement. Which is going to be valuable when we start creating these remarketing audiences around this data we're creating in this lecture, we're going to add another really cool custom container. That's going to track user engagement in the form of time on site now. Yes. Google analytics does track average session duration but there's something quite unique or a couple quite unique things about this custom container. We're gonna add This container will track the time spent on every page on your site and 15 2nd increments. But more importantly, it's gonna pause the time tracking when your website is not the active tab in the user's browser and it's also going to pause the time tracking when the user's mouse was idle. Or Gnocchi was clicked or Button was clicked wi...
thin 65 seconds by default. But we could Edit that 65 seconds time parameter to whatever you would like it to be. And I'm going to show you how to do that. It's a really cool custom plug in and it's gonna help once again get more nuanced information about our users data. Again, we're gonna be creating these remarketing audiences around the data we're collecting. What we're doing here is that stage of actually collecting that data? We need to create the process or trigger the process that collects and processes that data. Once we have that data inside our google analytics server which is then displayed in our google analytics dashboard will be able to use that data to create really cool, powerful profitable re marketing audiences to be used in our re marketing campaigns. So let's jump right in in this lecture, you're gonna have a link to the document that contains the Jason container. Once again shout out to the awesome guys who read luna metrics for helping to collaborate and create this this excellent customizable container. So we're going to download that document. Once you jump over to that link, go back into google tag manager, select admin. We're gonna import another container. We're gonna we're gonna choose our container file that we just downloaded. We'll open that up. Once again we want we want to click on merge and we want to click on rename conflicting tags, triggers and variables. We don't overwrite what's currently in our container and click continue. It's going to show us that we have two new tags coming in one new trigger, five new variables. We could view the details of those changes to see the names of everything that's going to come in and once again we go ahead and click confirm. Let's head over into our tag section to see what changed. Just without without even leaving the overview pane. We could see that there are a bunch of unpublished changes here for new tax to new triggers seven variables. Um now editing version 15 with 13 unpublished changes but we can go over here into the tags area and you're gonna see we have a couple of new things going on. First of all we have the engagement Tiner, we have the engagement timer, luna metrics plug in. This is the custom html. If we go into here and just like you saw in the previous lecture, here's a lot of the custom html. That's going to be the basis for the events and the triggers and the variables that are going to come from this actual tag. And this tag is gonna fire on every page on every page load and click cancel. Since we're not editing anything over here. We are going to have to leave, we are going to have to edit the event engagement. Timer, click into here, click on configure tag. We edit it and we're gonna have to go into google google analytics and get our tracking idea again as you know how to do. So let's jump into google analytics grab. Are you a number paste in where it's supposed to be pasted in and leave everything else as is with this event. We're just gonna have a category and action. You could add your own label and value if you'd like but the category is gonna be time we could label if we want time on site or engagement whatever you want. So let's leave it, leave it as time on site and the action is going to be a dynamic variable and this is a dynamic variable. And if we jump into the variable section we'll see that which is coded in the custom html. That's going to send this information back to google analytics. How long in seconds we've been on the site, go ahead and click save tag and it's gonna fire on that new trigger that came in. If we go into the trigger section we'll see event engagement. Timer is the trigger and it's filtering based on different parameters that came in in that custom coding in the in the custom container that we just set up variables. We'll see down here below some new variables, engagement timer, Idol milliseconds, so on and so forth. About um 12345 different variables that this container imported for us. And we don't have to do a thing to set it up once we really just made that one change that we have to make here, which is adding are you a I. D into the event tracking tag? We can go ahead into our preview mode and we can see how this tag is actually working on our site. So let's jump over into our site and we're gonna get our dialogue and we see right away that the engagement timer, luna metric plug in tag fired right away which which it should. Now we're gonna move around the page a little bit and let's wait a few seconds and watch what happens with this g a event engagement timer, boom right there. Okay. It it fired and that's going to be sending back probably that 1st 15 2nd timer. So if we go over to engagement timer on this, in the actual um tags, firing pain on the left, click on engagement timer and we click on variables, We'll see that the interval in milliseconds was 15,000, which is 15 seconds. Okay, engagement time or seconds over here. 15 Now I will continue to move around the page. We're gonna see it again. Here's 11, 30 seconds and 12:45. As I go over to another page, it's going to load up again and it's gonna start again. Fresh. Now, what's another really powerful function of this plug in is it allows you to track these engagement metrics on any individual page. So if you're running a campaign with a specific landing page or a particularly valuable page, like a contact us page, you could you could specifically remark it to people who spent at least three minutes on your contact us page. That's something that you would not easily be able to do on your own without this sort of plug in through google tag manager. So it's super cool. If we go over to the engagement timer again on the left hand side, click on variables, we'll see that it's initially pulling in our first Or our second rather 32nd variable. Now, you know, as I've conditioned you that we're going to continue to quality control, test this implementation to see if it's actually working. So let's go ahead and published this container. All right, we can leave preview mode, let's go back and reload our site and let's go to a new page and let's just wait around this page will move a little bit, click around a little bit, going to the form just to you know, Go back and forth. We don't want to be idle for too long but you know, it is 65 seconds so we could be idle for a little bit. And now once we've spent some time on this page, let's go over to Google analytics and see if the event is actually sending back to Google analytics which we obviously needed to do. Go back to our reporting, we'll go to real time reporting, we'll go to events and we should see If we go to events last 30 minutes time on site which are these, you know 75789 are all properly coming back into Google analytics. And what's really cool is we have the event category which is time on site which is what we named it back in Google Tag manager and we have 30 seconds to events were triggered. 45 seconds to events were triggered. seconds. One event was triggered. Super, super cool. What this is going to allow us to do is create audiences around these specific events on specific pages and be able to use those audiences in re marketing campaigns. So super powerful right now we need to do nothing else. The data is tracking its working the events and the event categories and actions are being sent successfully back into google analytics. So we're in terms of a data collection process. We are good to go, the data is being collected granted. We didn't figure out how we want to use this data. We didn't figure out exactly how we want to segment this data out what ads we want to show to, which people on which pages if our contact us page should be a minimum of of of two minutes of a um our home page should be a minimum minimum of seven minutes to qualify for a re marketing campaign granted. But we're collecting that data in a really sophisticated way. Now let's go back into Google Tag manager and do one. Really cool customization, let's say 65 seconds. Let's say the 65 2nd window was too long for your personal taste or it might even be too short. Remember when I told you that this plug in by default? Well stop tracking engagement Or it will stop counting seconds when a user is idle for 65 seconds or more. But let's say, you know your website, you know that you know the kind of behavioral patterns of your visitors and you would you feel that 20 seconds if somebody's idol on your page and they haven't clicked a keyboard key or move their mouths for 20 seconds. You want to stop that engagement timer So we can actually edit that in order to edit that. We're gonna go into our variables and we're gonna click on engagement timer. Idol in milliseconds. This is a constant variable. That's gonna tell our tag to stop counting to stop sending those events back into google analytics. If a user is idle for 6500 milliseconds or 65 seconds In length. So if we go ahead and just simply edit this this this configurable variable and we change it to 20,000 because by default this container set up to work in milliseconds and this is 20 seconds 20,000 milliseconds, 20 seconds we save the variable and now we republish the container and now this timer will stop tracking if our mouse stops moving or we don't click aqui in 20 seconds and we could make that higher or lower whatever suits your needs best. So this is a really powerful tag variable trigger combination that's sending sophisticated data back into google analytics, you're able to track specific levels of engagement on specific pages of your site which is really powerful. And it also pauses that timer when a user is idle when they haven't clicked a key or they haven't moved their mouse or if they move into a different page, let's say they're browsing on on your site and they decide to go over to Spotify. Um they're gonna go hang out and watch them and listen to some music or they're gonna go over to netflix and watch a video or Youtube. It's gonna stop that engagement timer from tracking engagement on your site. So it allows you to create some very real and accurate and reliable information about how engaged your users are, how much time they're spending on specific key pages of your site. And we'll be able to use that in our re marketing campaigns and we'll be able to use that in combination with our scroll depth tracking. Just think of the possibilities now, now that you have these two very advanced containers, we could have a we can have a re marketing audience That targets people who have scrolled 75% of our contact us page. And they've also been on that page for three minutes and that three minute threshold is more accurate now because we're making sure that those three minutes are three minutes that don't have more than a 22nd or 65 2nd or whatever time interval laps in activity. So really really advanced stuff. And we're gonna use this stuff and I'm gonna show you step by step how to set up those audiences when we finally get to that stage. So thank you very much for watching this one guys. I look forward to seeing you very soon in the next lecture. Keep on trucking. You guys are doing great, and we're very close to starting to really build out our actual, practical, profitable, advanced professional re marketing campaigns. Talk to you guys soon.