Scroll Tracking with Google Tag Manager

Want create site? Find Free WordPress Themes and plugins.

Almost a year ago LunaMetrics posted a great scroll tracking script for Google Analytics. I won’t get into details why to implement this tracking and what are the benefits from it (you can read that in the original LunaMetrics article). Instead I’ll show you how to implement this scroll tracking with Google Tag Manager step by step.

Step One – the Scroll Tracking Script

First – we start with an HTML tag, containing the JavaScript for the scroll Tracking. I borrowed the Lunametrics script and modified it to work with Google Tag Manager.

Copy the following script and paste it in new HTML Tag:

 

The default setup of the script is tracking 0%(Baseline), 25%, 50%, 75% and 100% scroll activity. If you want to use other fractions (for example – 10, 20, 30…) you just need to modify rows 67-69.

Step Two- the Scroll Tracking Trigger

While in most cases your guts tell you to add “All Pages” as a trigger for your HTML tags – I prefer to use the Windows Loaded event, so the script won’t slow down your website loading speed. Doing that is easy – just create a new trigger with the built-in Windows Loaded option:

gtm.load trigger in Google Tag Manager

I use gtm.load as name of the trigger, but you could give it another one. You can save the tag now.

Step Three- the Scroll Tracking Variable

Now, as you have your HTML tag it’s time to send the data to Google Analytics. To do that you first need to setup a variable which collects the percentage of the scroll, that is pushed on rows 4 and 88 of the scroll tracking script. Create a new Data Layer variable and use ‘scrollDepth’ as Data Layer Variable Name:

GTM Scroll Tracking - varible

Step Four- the Scroll Tracking Trigger

That’s an easy one – you just need to create a Custom Event trigger to fire the Scroll Tracking Event:
GTm Scroll Tracking trigger The name of the event should be ‘scrollTracking’, as it’s defined in the script. If you want to use another name you should tweak the script in row 4 and 88.

Step Five- the Scroll Tracking Event

Now you have everything ready to send to Google Analytics. You just need to create Google Analytics Event tag and fill the fields as follows:
Scroll Tracking Event in Google Tag Manager You can put any name in Event Category, for Event Action add the Data Layer Variable you just created earlier and for trigger of the tag use the previously added custom event trigger. For Event Label you can add anything (or nothing at all). I always add the GTM Built-in variable {{Page URL}} as a back up of the Page Dimension.

Don’t forget to add ‘True’ in the ‘Non-Interaction Hit’ Dropdown, as if it’s set to the default “False” this event will disrupt your Bounce Rate.

Publish your Scroll Tracking!

If you did everything from this article your scroll tracking should be ready now. Debug the tags and if everything works properly just Hit the “PUBLISH” button.
Happy Analyzing!

Did you find apk for android? You can find new Free Android Games and apps.

Check these related articles:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.