You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support Ping requests to report a better 'time on page' #2041
Currently, the last page view is set with a 'time on page' of zero seconds.
Instead, we could regularly ping the Piwik server with a request that notifies Piwik that the user is still on the website.
This request should not record new page view, only increase the visit_total_time counter.
Also, we should only throw this request when the user is actually looking at the page, not doing something else in some other tabs.
The risk with this feature is that instead of improving the report accuracy, we end up inflating numbers: a lot of users leave pages open in other tabs for hours and don't do anything about it. We should heavily test to ensure we never throw a request on a page where the user didn't interact with recently. Some interactions we can maybe detect: mouse click, mouse move, etc.
Of course, we should not make everything slow by adding handlers on mouse move, etc.
Also, once this feature is implemented, a new checkbox should be added to the Advanced section in the 'Tracking Code' admin page. Checking it will generate JS code that enables this feature.
(In [3788]) fixes #739 - addEventListeners() on mouseup and mousedown; good catch, Matt!
utf8_encode() - required to convert multibyte char to string of bytes; for unit testing, it needs to be a separate function
killFrame() - would be called after a trackPageView(); used to prevent one's site from being frame by third-parties; there are tradeoffs (as you point) out, so it is not enabled by default
refs #2041 - setHeartBeatTimer - uses setTimeout, so it happens only once (vs setInterval is recurring); only happens on the landing page; intended to be used to improve bounce rate report; changed it to send ping=1 in the request
(In [3838]) refs #2041 - setHeartBeatTimer() now takes the minimumVisitLength and the heartBeatPeriod (time between pings) as parameters; this is simpler than initial ping + recurring hb; requests contain "ping=1".
Before enabling this by default I think we could try it on some heavy websites, that are using GA, other libraries (jquery eg.) and doing Javascript heavily. Then we could see if Piwik adds any unexpected performance overhead.
For example it would be nice to say: Piwik will query a few JS variables every second to assess if the visitor is active or not, but will not conflict with any other library or Javascript and should not affect performance at all.
What do you think? for example, have you tried it on a a running piwik loading the dashboard full of widgets.
I think, disabled by default, but easy to enable, this would make it a really cool feautre. Also, should be made available via the 'advanced' javascript tag generator see #1845
Just wondering where we are on this. I'm in the process of switching several sites from GA to Piwik, and this feature is pretty important to me. Does 1.x mean it's going to be in an indefinite release between now and 2?
Hi all,
+1 to the entire idea.
I'm using Piwik for my blog and I continuously see high bounce rates and no time on page for single page views.
And a short suggestion.
The feature is complex so don't try to make it perfect. Just do something.
If the discussion takes 4,5 years, there is something terribly wrong.
Make it Lean, use inspect and adapt. Release it with option to disable/enable the feature and people will give you feedback how it works what works what does not work.
Don't try to figure it all by yourself :)
The lack of any kind of real metric on single page views is really annoying.
Cheers and thanks for all the great job done on Piwik.
many thanks for documenting this!
Is there a setting how often website send this alive information?
not every body needs it every second, but every 60seconds maybe to long for others...
and of course you may need to find an individual balance between accuracy and server-load
many thanks for documenting this!
Is there a setting how often website send this alive information?
not every body needs it every second, but every 60seconds maybe to
long for others...
and of course you may need to find an individual balance between
accuracy and server-load
—
Reply to this email directly or view it on GitHub #2041 (comment).
thanks for pointing there.
_To use this feature use tracker.enableHeartBeatTimer(); or _paq.push(['enableHeartBeatTimer']);. By default, a ping request will be sent every 15 seconds. You can specify a custom ping delay (in seconds) by passing an argument, eg, tracker.enableHeartBeatTimer(10); or paq.push(['enableHeartBeatTimer', 10]);.
If this is working fine it should be added to docu as well..
Activity
robocoder commentedon Jan 21, 2011
(In [3788]) fixes #739 - addEventListeners() on mouseup and mousedown; good catch, Matt!
refs #2041 - setHeartBeatTimer - uses setTimeout, so it happens only once (vs setInterval is recurring); only happens on the landing page; intended to be used to improve bounce rate report; changed it to send ping=1 in the request
robocoder commentedon Feb 3, 2011
I reworked setHeartBeatTimer() in [3830]. It now takes an initalPingDelay and recurringHeartBeatDelay as parameters. By default, this is disabled.
robocoder commentedon Feb 3, 2011
The initial ping request contains "ping=1". Use this to improve bounce rates and visit time.
Subsequent heartbeat requests (if recurringDelay != 0) contain "hb=1".
I'm going to defer adding event handlers as there are issues with propagating some events like keyclicks.
Mental notes to self:
mattab commentedon Feb 3, 2011
how do you define 'activity'? Will the ping be sent if user is looking at another tab, another window, or even away from computer?
robocoder commentedon Feb 3, 2011
activity: mousemove, click, mouseup, mousedown, mousewheel, scroll, DOMMouseScroll, resize, keypress, keydown, keyup, focus, and blur
Yes, ping would be sent. That's why there's a check for activity. If there's no activity, I propose to no longer check.
I'll commit my changes after some more testing.
robocoder commentedon Feb 3, 2011
(In [3838]) refs #2041 - setHeartBeatTimer() now takes the minimumVisitLength and the heartBeatPeriod (time between pings) as parameters; this is simpler than initial ping + recurring hb; requests contain "ping=1".
also updated to jslint 2011-02-03
robocoder commentedon Feb 3, 2011
(In [3839]) refs #2041 - rollback buggy n/2 logic
robocoder commentedon Feb 3, 2011
(In [3840]) refs #2041 - undo previous optimizaton to ping on first page of a new session
robocoder commentedon Feb 3, 2011
(In [3841]) refs #2041 - add guard
robocoder commentedon Feb 8, 2011
Client-side changes are done, so it would be nice to have the server-side change done in time for 1.2 but we can roll into the next milestone.
mattab commentedon Feb 9, 2011
How often are the activity tests done? every second? Just thinking of keeping JS performance overhead low with this new feature.
I wont be able to do this in time for 1.2, so it will go in 1.3. Is pinging disabled by default? thx
robocoder commentedon Feb 9, 2011
Yes, disabled by default; frequency is user-defined.
mattab commentedon Feb 17, 2011
Before enabling this by default I think we could try it on some heavy websites, that are using GA, other libraries (jquery eg.) and doing Javascript heavily. Then we could see if Piwik adds any unexpected performance overhead.
For example it would be nice to say: Piwik will query a few JS variables every second to assess if the visitor is active or not, but will not conflict with any other library or Javascript and should not affect performance at all.
What do you think? for example, have you tried it on a a running piwik loading the dashboard full of widgets.
mattab commentedon Apr 28, 2011
I think, disabled by default, but easy to enable, this would make it a really cool feautre. Also, should be made available via the 'advanced' javascript tag generator see #1845
anonymous-matomo-user commentedon Sep 28, 2011
Just wondering where we are on this. I'm in the process of switching several sites from GA to Piwik, and this feature is pretty important to me. Does 1.x mean it's going to be in an indefinite release between now and 2?
47 remaining items
diosmosis commentedon Jun 25, 2015
Fixed in #8069.
robocoder commentedon Jun 25, 2015
@diosmosis \o/
Add doc for enableHeartBeatTimer function. refs matomo-org/matomo#8069 …
jgebal commentedon Jul 11, 2015
Hi all,
+1 to the entire idea.
I'm using Piwik for my blog and I continuously see high bounce rates and no time on page for single page views.
And a short suggestion.
The feature is complex so don't try to make it perfect. Just do something.
If the discussion takes 4,5 years, there is something terribly wrong.
Make it Lean, use inspect and adapt. Release it with option to disable/enable the feature and people will give you feedback how it works what works what does not work.
Don't try to figure it all by yourself :)
The lack of any kind of real metric on single page views is really annoying.
Cheers and thanks for all the great job done on Piwik.
ReessKennedy commentedon Jul 17, 2015
+1 to this as well. And agreed with @jgebal.
This would be really great option to enable!
mattab commentedon Jul 22, 2015
@ReessKennedy feel free to post in the other issue: #8225 (this issue here is closed)
Add documentation for enableHeartBeatTimer
mattab commentedon Dec 18, 2015
Feature is now documented at Accurately measure the time spent on each page
hpvd commentedon Dec 18, 2015
many thanks for documenting this!
Is there a setting how often website send this alive information?
not every body needs it every second, but every 60seconds maybe to long for others...
and of course you may need to find an individual balance between accuracy and server-load
VincentSC commentedon Dec 18, 2015
This is documented in the changelog: http://developer.piwik.org/changelog
On 18/12/15 11:43, hpvd wrote:
V.G.Hindriksen MSc., CEO
StreamComputing BV - http://www.streamcomputing.eu
Location: Amsterdam, Netherlands, Europe
Cell: +31 6 45400456
NEW PHONE NUMBER: +31 854865760
KvK-number (Chamber of Commerce): 61901873
Rabo Bank (IBAN/SEPA): NL89RABO0113885571 - BIC: RABONL2U
OpenCL Newsletter: http://bit.ly/OpenCLnewsletter
OpenCL Twitter : http://twitter.com/StreamComputing
OpenCL Blog : http://www.streamcomputing.eu/blog
PGP Public key : http://bit.ly/VincentHindriksenPGP
hpvd commentedon Dec 18, 2015
thanks for pointing there.
_To use this feature use tracker.enableHeartBeatTimer(); or _paq.push(['enableHeartBeatTimer']);. By default, a ping request will be sent every 15 seconds. You can specify a custom ping delay (in seconds) by passing an argument, eg, tracker.enableHeartBeatTimer(10); or paq.push(['enableHeartBeatTimer', 10]);.
If this is working fine it should be added to docu as well..
mattab commentedon Dec 20, 2015
@hpvd improved the doc, and also created New FAQ: How do I improve accuracy of “Time spent on page” and “Visit duration” metrics?
hpvd commentedon Dec 21, 2015
Thanks very much!
masteranalyze commentedon Feb 1, 2016
good work @mattab and the team!