Set up content tracking
Content tracking lets you collect data about impressions and interactions with elements on your website. For example, you can track a visitor who sees a banner and clicks the button on it.
To set up content tracking, you need to turn the content tracking option in Piwik PRO’s settings and tag the element on your website. Once you finish the setup, the collected data will appear in the content performance report.
In this article, we’ll show you how to adjust content tracking correctly.
Before you start
Here are some things to know before you begin working with content tracking:
- By default, content tracking works for a custom pop-up tag and a custom content tag.
- To tag an element on your website, you need to have access to your website’s code. You could also tag an element using Tag Manager, but this is a more complicated method.
Definitions and metrics in content tracking
Before you code your website and adjust settings in Piwik PRO, you should understand the definitions and metrics used for content tracking:
- Content block: An element on your website that consists of a content name, piece, and target.
- Content name: A name of the tracked content block. The name will show up in the report. You can use one name for many content pieces.
- Content piece: A piece of the tracked content block, for example, a creative, banner, or video. The piece will show up in the report.
- Content target: A target of the tracked content block, for example, a link in the content block. The target will show up in the report.
- Content impressions: The number of times a content block was displayed to visitors.
- Content interactions: The number of times visitors interacted with a content block, for example, clicked an element in a content block.
- Content interaction rate: A percentage that tells you how many people interacted with a content block.
Content interaction rate = Content interactions / Content impressions * 100%
Turn on content tracking
To start, you need to enable content tracking in the Piwik PRO tag, which is responsible for collecting data on your website.
To turn on content tracking, follow these steps:
- Go to Menu > Tag Manager.
- Navigate to Tags.
- From the left-hand list, select Piwik PRO.
- In Piwik PRO Analytics setup, toggle
Enable content tracking.
- Select if you want to track
All content impressionsor
All visible content impressions.
The difference between those two options is:
- All content impressions: The tracker counts an impression after a page with content loads, no matter if it is visible or not.
- All visible content impressions: The tracker records an impression if the content becomes visible for a visitor, for example, when a visitor scrolls down and sees a banner.
Tag an element on your website
Next, you need to add a piece of code to an element on your website that you want to track. Let’s take an example from the Clear Bank website where we have a banner with a newsletter signup. We want to know the number of people who viewed the banner and the number of people who clicked a button on the banner. To collect this data, we will need to tag the banner.
To tag an element, you can use the following attributes or CSS classes:
.piwikTrackContent: Define a content block.
[data-content-name=""]: Defines the name of the content block.
.piwikContentPiece: Define the content piece.
.piwikContentTarget: Define the content target.
To tag an element, follow these steps:
- Find the element on your website that you want to track. For example, a div class of the banner.
- Add a
piwikTrackContentclass or a
data-track-contentattribute to HTML. For example:
- Add a content name, piece, and target to HTML. You can add only a name. For example:
Add a class:
<div class="et_pb_column et_pb_column_4_4 et_pb_column_16 et_pb_css_mix_blend_mode_passthrough et-last-child piwikTrackContent">
Add an attribute:
<div class="et_pb_column et_pb_column_4_4 et_pb_column_16 et_pb_css_mix_blend_mode_passthrough et-last-child" data-track-content>
Add a class:
<button type="submit" class="et_pb_contact_submit et_pb_button piwikContentPiece" >Subscribe</button>
Add an attribute:
<button type="submit" class="et_pb_contact_submit et_pb_button" data-content-piece="subscribeButton">Subscribe</button>
Content performance report
After enabling content tracking and tagging elements on your site, the tracker will start collecting data. The data will appear in the content performance report.
To view the content performance report, follow these steps:
- Go to Menu > Analytics (new).
- Navigate to Reports.
- On the left, click Content performance.
- View the report.
Tip: In Analytics (classic), the similar report is called the content report (Menu > Analytics > Actions > Contents).