[quote=vipsoft]
IIRC, GA fakes it. If you don’t want to see 0, you can change the default setting in config/config.ini.php:
[General]
; treat bounce as a minimum 30 second visit
default_time_one_page_visit = 30
Note: the client-side changes have already been implemented for re-track (ping/heartbeat).[/quote]
This setting has to go under [Tracker] not [General] .
I too am interested in not showing 0 seconds for one page visit and did the change but was wondering why it was not catching my settings of 10 seconds (which comes a bit closer to one page visit ). So I looked up global.ini.php. And there it is under [Tracker]. Will know more tomorrow.
even after correct placing the entry under [Tracker] in config.ini.php it is NOT picked up.
Today I changed the setting in global.ini.php and IT IS picked up. At least in my case.
I built something that does this a while ago because I have a site that primarily has one page on it, and I wanted to see how long they spent there. It turns out to be useful on sites that have many pages as well.
Here is what I did:
I created a directory piwik/refresh
piwik/refresh contains two files piwik/refresh/refresh.js and piwik/refresh/refresh.php
The js file writes an img tag, and has a function that changes the src of that img every 45 seconds to the php file.
The php file reads the piwik cookie and updates the last action time and total visit time for the visit, and outputs a pixel gif.
Please keep in mind that the refresh.php file will not work for you as-is. It does not use piwik’s database connection, I use a different class for db access. If someone wants to modify it to work with piwik’s configuration and db access, please do.
even after correct placing the entry under [Tracker] in config.ini.php it is NOT picked up.
Today I changed the setting in global.ini.php and IT IS picked up. At least in my case.
Why, no idea. Just wanted to let you guys know.[/quote]
For Piwik 1.2 the above settings in config.php are picked up correctly.
Has anyone used this? I tried but it doesn’t seem to write anything to the database? I did setup the DB name, table name, user, pass inside the refresh.php script. Absolutely no idea why it doesn’t work and I’m not that skilled to even think of stuff to test to see where the problem might be. Any ideas?
Thanks!
[quote=TucsonKEG]
I built something that does this a while ago because I have a site that primarily has one page on it, and I wanted to see how long they spent there. It turns out to be useful on sites that have many pages as well.
Here is what I did:
I created a directory piwik/refresh
piwik/refresh contains two files piwik/refresh/refresh.js and piwik/refresh/refresh.php
The js file writes an img tag, and has a function that changes the src of that img every 45 seconds to the php file.
The php file reads the piwik cookie and updates the last action time and total visit time for the visit, and outputs a pixel gif.
Please keep in mind that the refresh.php file will not work for you as-is. It does not use piwik’s database connection, I use a different class for db access. If someone wants to modify it to work with piwik’s configuration and db access, please do.
Good news! Starting in Piwik 2.14.0 the new feature of tracking how long users stay on page (using a Heart beat timer “ping” request) has been released. You can enable it with
_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,
And it is tracked perfectly, but not the time. It always shows wrong value.
I could spend 3+ minutes on one page but the dashboard shows me either 00:00:00 or something like 00:00:01 which is not correct.
I see that ping requests are performed.
What can be wrong here? What information else should I provide?
Thank you in advance.
Heartbeat should work perfectly fine in the last Piwik version. if you have any issue please create a bug report on : Issues · matomo-org/piwik · GitHub