@miiimooo opened this Issue on August 23rd 2022

Comparing Matomo Analytics Time spent on page and GA Time spent on page averages, they differ wildly.

Matomo will often be below 1 minute, when GA is over 1 minute, some examples

Pageviews Unique Pageviews Bounce rate Average time on page 
1. 78,845       63,367                     46%            00:00:40
2. 28,467       25,418                     83%            00:00:14
3. 20,403       19,650                     58%            00:00:10
Page Views Unique Page Views Bounce Rate Avg.Time on Page
1. 48,787         39,599                      53.79%         00:01:21
2. 25,744         23,124                      87.44%         00:01:34
3. 17,365         16,735                      96.52%         00:02:54

Providing some more metrics to show that everything else looks pretty similar.

Is there any way I can help to debug this? I'm using Matomo tag manager with heartbeat enabled

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for Bugs)



Your Environment

  • Matomo Version:4.10.1
  • PHP Version:7.4.30
  • Server Operating System: Linux
  • Additionally installed plugins:API, AbTesting 4.1.7, Actions, ActivityLog 4.0.5, AdminNotification 4.0.0, Annotations, Bandwidth 4.0.1, BotTracker 2.07, BulkTracking, Contents, CoreAdminHome, CoreConsole, CoreHome, CorePluginsAdmin, CoreUpdater, CoreVisualizations, CoreVue, CustomAlerts 4.1.0, CustomDimensions, CustomJsTracker, CustomReports 4.0.15, DBHealth 0.0.11, DBStats, Dashboard, DevicePlugins, DevicesDetection, Diagnostics, DisableWarnings 0.1.0, Ecommerce, Events, ExtraTools 4.0.1-beta2, Feedback, FormAnalytics 4.0.8, Funnels 4.0.11, GeoIp2, Goals, GoogleAnalyticsImporter 4.2.0, GroupPermissions 4.0.5, Heartbeat, HeatmapSessionRecording 4.4.3, ImageGraph, Insights, Installation, Intl, IntranetMeasurable, InvalidateReports 4.1.0, LanguagesManager, Live, LogViewer 4.1.0, Login, LoginSaml 4.1.2, MarketingCampaignsReporting 4.1.1, MediaAnalytics 4.1.2, MobileAppMeasurable, Monolog, Morpheus, MultiChannelConversionAttribution 4.0.5, MultiSites, Overlay, PagePerformance, PrivacyManager, ProfessionalServices, Proxy, QueuedTracking 4.0.4, Referrers, Resolution, RssWidget, SEO, ScheduledReports, SecurityInfo 4.0.2, SegmentEditor, SitesManager, TagManager, TestRunner, Tour, TrackerDomain 0.2.3, Transitions, TreemapVisualization 4.0.1, TwoFactorAuth, UserConsole 4.0.0, UserCountry, UserCountryMap, UserId, UserLanguage, UsersFlow 4.0.4, UsersManager, VisitFrequency, VisitTime, VisitorInterest, VisitsSummary, WebsiteMeasurable, Widgetize
  • Browser:
  • Operating System:
@sgiehl commented on August 23rd 2022 Member

Hi @miiimooo
Thanks for creating this issue. Unfortunately there isn't much we can do about that. As long as you can't give use detailed insights how Google Analytics is calculating their time on page, we are unable to say why those numbers differs.
I can actually only refer you to our FAQ, that explains how we calculate the metric: https://matomo.org/faq/how-to/faq_21158/

@miiimooo commented on August 24th 2022

@sgiehl apologies for continuing in this thread. But in case you can advise, looking around GA is or was suffering from the same problem, and people recommended using a heartbeat like approach. If I understand it right, then in both GA and Matomo, this is handled when the next hit happens. Which sounds simple at first, but then - thinking about it - must be quite complex. Because somehow Matomo must keep track of the user, either in the client or the browser to reliably send the previous hit to the server. Looking at the 2nd request, it includes a urlref parameter in the payload. I see there is also a pv_id which must be the client unique id. So the server must then look up that previous url and modify the stored request and set the correct visit duration. Is that how it works?

@sgiehl commented on August 24th 2022 Member

No. Afaik it's actually a way less complex in Matomo. Visitors are identified with unique visitor ids, that are sent with the tracking requests. All tracking requests with the same visitor id will be tracked into one visit, unless the last tracking request was more than 30 minutes ago, in that case a new visit will be started for the visitor. The time on page will be simply calculated based on the page views being tracked. So the time between two page views is actually the time on page for the first page view. The last page view by default doesn't have a time on page, unless some further tracking requests are sent, that update the end time of the visit.

@miiimooo commented on August 24th 2022

This visitor id, is it stored somehow locally, it must be right? I'm asking since we have enabled "Disable cookies" in MTM. Could that maybe impact on the Time On Page functionality?

@sgiehl commented on August 24th 2022 Member

The visitorid is stored in the cookie if possible. So not using cookies might make the visitor recognition a bit less accurate, as the visitors are then being matches based on a config hash, that is build out of various browser details.
If you have more questions around that topic, maybe try discussing/asking that on our forum. I actually don't have enough time to give detailed answers on github.

@MatomoForumNotifications commented on September 21st 2022

This issue has been mentioned on Matomo forums. There might be relevant details there:


This Issue was closed on August 23rd 2022
Powered by GitHub Issue Mirror