Custom Page Metrics Tracking

Monitor specific interactions and behaviors at the page level with custom metrics that go beyond traditional pageviews. Track how readers engage with your content through detailed page-specific measurements.

Feature only available on the Enterprise Pricing Plan.

Page metrics capture quantifiable data about user actions on specific pages, enabling you to measure engagement quality rather than just quantity. Unlike custom variables that store categorical information, page metrics store numerical values that can be aggregated and analyzed.

Basic Usage

Track numerical metrics using the same key-value pattern as custom dimensions, but with numeric values:

  window.marfeel = window.marfeel || { cmd: [] };
  window.marfeel.cmd.push(['compass', function(compass) {
      compass.setPageMetric('engagedPV', 1);
      compass.setPageMetric('timeToFirstAd', 1);
  }]);

Enable Custom Metrics

Enable metrics in Organization > Tracking > Custom Metrics with aggregation options:

  • Total: Sum all metric values across selected pages
  • Total per User: Average metric value per unique user
  • Average per Pageview: Mean metric value per page visit
  • Total per Session: Average metric value per user session

Tracking custom metrics using Javascript Experiences

You can create a custom Javascript Marfeel Experience to track metrics measured via mark() or measure() you’re already monitoring using the Performance API.

if (('PerformanceObserver' in window)) {
    const observer = new PerformanceObserver((entries) => {
        for (const entry of entries.getEntries()) {
            if (entry.entryType === 'mark') {
                window.marfeel.cmd.push(['compass', (compass) => compass.setPageMetric(entry.name, Math.round(entry.startTime))]);
            } else if (entry.entryType === 'measure') {
                window.marfeel.cmd.push(['compass', (compass) => compass.setPageMetric(entry.name, Math.round(entry.duration))]);
            }
        }
    });

    observer.observe({ entryTypes: ['measure', 'mark'] });
}