Skip to content

Analytics Setup

This guide explains how to set up web and mobile app analytics for your News Suite installation using Matomo, including proper content attribution and audio analytics tracking.


WhiteBeard News Suite uses Matomo for comprehensive web and mobile app analytics. Matomo provides detailed insights into user behavior, content performance, and engagement metrics across your digital properties.


  1. Obtain Your Matomo Tag:

    • Contact WhiteBeard News Suite support to receive your unique Matomo tag
    • The tag will be provided in a format ready for your tag manager
  2. Insert the Tag:

    • Add the Matomo tag provided by support into your tag manager
    • Ensure the tag is configured to fire on all pages

This basic setup enables general analytics tracking across your website and mobile applications.


For accurate content performance tracking and detailed article analytics, additional data layer variables must be configured. This setup is essential for understanding which articles drive engagement and revenue.

Configure the following variables in your data layer before triggering your pageview event or other tracking events:

Variable NameTypeDescription
ArticleIdStringThe unique ID of the content or article the user is viewing
CategoryIdStringThe ID of the primary category for the content
ParentIdStringThe publication ID that the content belongs to
PremiumStringUser subscription status: 0 for non-subscribers, 1 for subscribers

Push data to the Matomo data layer using the following format:

window._mtm.push({
'ArticleId': 123,
'CategoryId': '2',
'ParentId': '1',
'Premium': 1
});
  • Article Pages: Push the data layer variables immediately when the article page loads, before any pageview or engagement events
  • Dynamic Content: Update the data layer when users navigate to different articles in single-page applications
  • Premium Status: Update the Premium variable if the user’s subscription status changes in the same page
// Example: Push data layer on article page load
document.addEventListener('DOMContentLoaded', function() {
if (typeof window._mtm !== 'undefined') {
window._mtm.push({
'ArticleId': document.querySelector('[data-article-id]').dataset.articleId,
'CategoryId': document.querySelector('[data-category-id]').dataset.categoryId,
'ParentId': document.querySelector('[data-publication-id]').dataset.publicationId,
'Premium': userIsSubscribed ? 1 : 0
});
}
});

For comprehensive documentation on using the Matomo data layer, including advanced configurations and troubleshooting, refer to the official Matomo documentation:

Matomo Tag Manager Data Layer Guide


If you’re implementing a custom audio player, you can track detailed audio engagement metrics by sending specific events to the Matomo data layer.

Push audio events using the following format:

window._mtm.push({
'event': 'audio_event',
'action': 'audio-start',
'AudioAttachmentId': 123
});
ParameterTypeDescription
eventStringAlways set to 'audio_event' for audio tracking
actionStringThe specific audio action being tracked (see below)
AudioAttachmentIdStringThe unique ID of the audio attachment being played

Track the following audio playback events to understand listener engagement:

ActionWhen to FireDescription
audio-startAudio begins playingFired when the user starts audio playback for the first time
audio-endAudio completesFired when audio playback reaches the end of the content
audio-listenedAfter 10 secondsFired once per page after 10 seconds of continuous playback (indicates genuine engagement)

Track listening duration by firing progress events every 10 seconds of playback:

ActionWhen to Fire
audio-progress-10After 10 seconds of playback
audio-progress-20After 20 seconds of playback
audio-progress-30After 30 seconds of playback
audio-progress-NContinue every 10 seconds (40, 50, 60, etc.)
audioPlayer.addEventListener('play', function() {
window._mtm.push({
'event': 'audio_event',
'AudioAttachmentId': audioId,
'action': 'audio-start'
});
});
// After 10 seconds of continuous playback (fires once per page)
let hasTrackedListened = false;
audioPlayer.addEventListener('timeupdate', function() {
if (!hasTrackedListened && audioPlayer.currentTime >= 10) {
window._mtm.push({
'event': 'audio_event',
'AudioAttachmentId': audioId,
'action': 'audio-listened'
});
hasTrackedListened = true;
}
});
// Fire every 10 seconds during playback
audioPlayer.addEventListener('timeupdate', function() {
const currentTime = Math.floor(audioPlayer.currentTime);
if (currentTime > 0 && currentTime % 10 === 0) {
window._mtm.push({
'event': 'audio_event',
'AudioAttachmentId': audioId,
'action': `audio-progress-${currentTime}`
});
}
});
audioPlayer.addEventListener('ended', function() {
window._mtm.push({
'event': 'audio_event',
'AudioAttachmentId': audioId,
'action': 'audio-end'
});
});

  • Validate Data: Ensure all data layer variables are populated correctly before pushing to Matomo
  • Consistent IDs: Use consistent ID formats across your implementation
  • Error Handling: Implement error handling to prevent tracking failures from breaking your site
  • User Consent: Ensure you have proper user consent before tracking, in compliance with GDPR and other privacy regulations
  • PII Protection: Never include personally identifiable information (PII) in custom variables
  • Subscription Status: The Premium variable should only indicate subscription status, not specific user identity

Before deploying to production:

  1. Verify Tag Installation: Confirm the Matomo tag fires correctly on all pages
  2. Test Data Layer: Check that all variables are being pushed with correct values
  3. Validate Events: Ensure audio events fire at the correct times
  4. Use Matomo Debugger: Utilize browser developer tools and Matomo’s debugging features to verify tracking

If data isn’t appearing in Matomo:

  • Verify window._mtm is defined before pushing data
  • Check browser console for JavaScript errors
  • Ensure the Matomo tag is loaded before data layer pushes

If article metrics aren’t tracking:

  • Confirm CategoryId and ParentId are being set on article pages
  • Check that data is pushed before pageview events

If audio analytics aren’t working:

  • Verify AudioAttachmentId is correct
  • Check that events fire at the right playback moments
  • Ensure 'event': 'audio_event' is included in all audio pushes

For assistance with analytics setup or custom implementations:

  • Contact WhiteBeard News Suite support for your Matomo tag and configuration
  • Refer to Matomo’s official documentation for advanced features
  • Work with your development team to ensure proper integration with your specific platform architecture