Go Back

How to Implement Piwik content tracking via Piwik PRO Tag Manager

Author

Why would you need content tracking?

Let’s say that you have a long landing page and you are wondering if visitors are even looking at the lower parts of the content. In a basic mode, Piwik web analytics tracks the number of pageviews, but does not track percentage of content that was displayed during the pageview.

This is where we can use the content tracking feature to check if our content is being read by our visitors.

To implement this option, we need to configure some additional elements in the source HTML of our page and add implement the appropriate Piwik features via Piwik PRO Tag Manager.

HTML configuration

Before we begin, we should mention a little bit about Content Name and Content Piece and what these terms mean:

  • Content Name refers to a batch of the content we want to track.
  • Content Piece refers to one of the elements of the Content tracking.

Data about both of these is stored in the Contents report which can be found in under the Actions option in the main menu.

In our example, we want to define two content pieces of which the first is followed by the second. The first piece will be called 1st set and the second one accordingly 2nd set. Both content pieces will be under one Content Name On-Premises LP Features.

All the details of the implementation can be found on the following screen:

HTML code of the tested elements
HTML code of the tested elements

You can find more information about the Content Tracking implementation HERE

To help Piwik recognize these HTML elements, we need to add some things into the Piwik code. We will do this using Piwik PRO Tag Manager.

Piwik PRO Tag Manager Configuration

There are two main types of the content tracking, and each one is strictly related to the method which we are using:

  • tracks all content blocks
  • _paq.push(['trackAllContentImpressions']);

  • tracks only visible content blocks
  • _paq.push(['trackVisibleContentImpressions']);

We will use this one because we want to know if our content is visible for users or not.

We can implement the correct option in two ways. It all depends on how we have implemented our main Piwik code.

Non-template Piwik implementation

If you have implemented your Piwik using an Asynchronous custom HTML tag you have only to add one line to the code – as follows:

Extended Piwik PRO code
Extended Piwik PRO code

Template Piwik implementation

This method has a one major advantage – we can easily execute additional functions on specific pages without affecting the whole website as we would with the main code. So, if you are using a Piwik template:

Choosing Piwik template
Choosing Piwik template

you have to create a new tag to insert additional snippet into the code.

We start with the + Add a tag button:

Piwik PRO Tag Manager - adding a tag
Piwik PRO Tag Manager - adding a tag

Now we configure the content of the tag. In the Tag HTML field we paste the afore-mentioned code line but within the script tags. Here is a bit of code for pasting:

<script>
_paq.push(['trackVisibleContentImpressions']);
</script>

It should look like this in the Piwik PRO Tag Manager configuration panel:

Configuring additional Piwik code
Configuring additional Piwik code

After this, we have to configure a trigger which will determine when the tag will fire. Like before we can decide whether we want to execute this snippet across the whole website or on only pages which we intend to monitor. We have decided to fire this tag only on the landing page in question. Because of this, the trigger configuration should be following:

  1. We set an easily recognizable Trigger Name.
  2. We have choosen Page View from the Loads on and On state menu.
  3. We have set the correct Condition for a trigger – Page URL contains “on-premises-self-hosted-enterprise-web-analytics” because the URL of the landing page is https://piwik.pro/c/on-premises-self-hosted-enterprise-web-analytics/.
Trigger configuration
Trigger configuration

We have saved the trigger configuration by clicking Add and Save after that.

To make our tag go live with the latest changes we click Publish

Publishing last changes
Publishing last changes

Piwik Report

Now we have to check our report to see if any new data came in to Piwik. We go to the Contents report under the Actions main menu option (read more about if from Actions Reports User Guide):

Content tracking reports in Piwik PRO
Content tracking reports in Piwik PRO

As you can see, we now have new data about our content pieces.

Free Comparison of 5 Enterprise-Ready Tag Management Systems

Get to know the 40 key differences between Google Tag Manager, Tealium, Adobe Dynamic Tag Management, Ensighten & Piwik PRO:

Download FREE Ebook

Author:

Szymon Grzesiak, Marketing Tech Lead

Experienced Performance marketing Specialist with tech knowledge.

See more posts of this author
Free Comparison of 5 Enterprise-Ready Tag Management Systems
 Free Comparison of 5 Enterprise-Ready Tag Management Systems

Share