Track content impressions and interactions (clicks)
If you are using the Matomo JavaScript Tracker then you need to find it within the body of your page code. Then you need to add the relevant content tracking code, depending on which tracking method you want to use.
Track Visible Content Impressions (Recommended)
If you only want to track an impression when the content is visible on screen, then you need to use the following code:
_paq.push(['trackVisibleContentImpressions']);
The above code should be placed directly under _paq.push(['trackPageView']);
as shown below:
_paq.push(['trackPageView']);
_paq.push(['trackVisibleContentImpressions']);
Track All Content Impressions
If you want to track a content impression as soon as it is loaded on the page, regardless of whether the visitor actually saw it or not, then you should use the following code instead:
_paq.push(['trackAllContentImpressions']);
The above code should be placed directly under _paq.push(['trackPageView']);
as shown below:
_paq.push(['trackPageView']);
_paq.push(['trackAllContentImpressions']);
Markup your content that you want to track
Once you have enabled content tracking for your site, you will still need to specify which pieces of content to track. To do this you should add the data-track-content
attribute to the HTML of an element you’d like to track. You can find more details on this later in this section.