Custom page metrics tracking with the Marfeel SDK
Custom page metrics let you track numerical engagement data at the page level, going beyond traditional pageviews. Use them to measure how readers interact with your content through detailed, page-specific measurements.
Page metrics capture quantifiable data about user actions on specific pages, enabling you to measure engagement quality rather than just quantity. Unlike custom dimensions that store categorical information, page metrics store numerical values that can be aggregated and analyzed across your engagement reporting.
Basic usage
Section titled “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
Section titled “Enable custom metrics”Enable metrics in Organization > Tracking > Custom Metrics with the following 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
Section titled “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'] });}Data freshness and consolidation
Section titled “Data freshness and consolidation”Custom metrics are not consolidated in real time.
During the first moments after tracking starts, values are systematically inflated due to partial aggregation and ongoing consolidation processes. This behavior is expected.
As a result:
- Metrics are inflated during the first hour after being tracked
- Values may remain unstable or slightly inflated for up to 24 hours
- Short time ranges (e.g. “Last hour” or “Today”) can show significant fluctuations
- Metrics become fully accurate only after the full 24-hour consolidation window
For reliable analysis and decision-making, evaluate custom metrics only after they have fully consolidated. Avoid drawing conclusions from data within the first 24 hours of tracking.
What is the difference between custom page metrics and custom dimensions?
Custom dimensions store categorical information, while custom page metrics store numerical values that can be aggregated and analyzed. Page metrics capture quantifiable data about user actions on specific pages.
How long does it take for custom page metrics to become accurate?
Custom page metrics are not consolidated in real time. Values are inflated during the first hour and may remain unstable for up to 24 hours. Metrics become fully accurate only after the full 24-hour consolidation window.
What aggregation options are available for custom page metrics?
Four aggregation options are available: Total (sum all values across pages), Total per User (average per unique user), Average per Pageview (mean per page visit), and Total per Session (average per user session).