Set up scroll tracking events in Tag Manager
The basic report in Piwik PRO about specific pages contains the number of page views, average time spent on the website and bounce rate. But what about seeing particular elements on the page seen by visitors? One way of extending this data is to implement Scroll Tracking using Events fired up in exact moment of scrolling. For this example, we want to measure four stages of the page: 25%, 50%, 75% and 100% of a scroll. To do this we have to implement 4 similar Events.
As described earlier Events are defined by 4 elements – we are going to use 3:
- Category = Scroll
- Action = 25%, 50%, 75%, 100% (4 different events)
- Name = URL of the page
Let’s take a look at how to implement the first event – after 25% scrolled on the homepage.
1. Create a Tag based on Piwik PRO Custom Event template:
2. Set up the event with Category, Action and Name:
Right here we are using Variable for Name element. Thanks to this Tag Manager will send to Piwik PRO event tailored for each page – the system will put the page URL of the current page where the Event is fired up.
3. Create a trigger which will allow the tag to fire in the desired moment – It is crucial to fire such tag only once per page view. Otherwise we would get misleading reports, for example, someone scrolling up and down will generate 4 scroll event for 25% – page can be only once scrolled to 25%. We are firing this tag on all pages of the website – Variable in Event Name will distinguish pages in the reports automatically.
Now we have to configure 3 more tags with a different percentage. This process is identical as above – we just have to type 50%, 75% and 100% instead of 25%.
After saving and publishing all the 4 tags we can check the configuration firstly using Debug mode. We are going to one of the pages where scroll tracking is configured and looking on the tag list on the right – the result of scrolling nearly to the end:
Now let’s go to Piwik and check if Piwik is reading those event requests correctly. The first one of the records in Visitor Log:
Second Events Report on the Event Name level for particular URL: