{"action":"created","issue":{"url":"https://api.github.com/repos/piwik/piwik/issues/2041","labels_url":"https://api.github.com/repos/piwik/piwik/issues/2041/labels{/name}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/2041/comments","events_url":"https://api.github.com/repos/piwik/piwik/issues/2041/events","html_url":"https://github.com/piwik/piwik/issues/2041","id":37352383,"number":2041,"title":"Support Ping requests to report a better 'time on page'","user":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/piwik/piwik/labels/Enhancement","name":"Enhancement","color":"bfd4f2"}],"state":"open","locked":false,"assignee":{"login":"diosmosis","id":125140,"avatar_url":"https://avatars.githubusercontent.com/u/125140?v=3","gravatar_id":"","url":"https://api.github.com/users/diosmosis","html_url":"https://github.com/diosmosis","followers_url":"https://api.github.com/users/diosmosis/followers","following_url":"https://api.github.com/users/diosmosis/following{/other_user}","gists_url":"https://api.github.com/users/diosmosis/gists{/gist_id}","starred_url":"https://api.github.com/users/diosmosis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diosmosis/subscriptions","organizations_url":"https://api.github.com/users/diosmosis/orgs","repos_url":"https://api.github.com/users/diosmosis/repos","events_url":"https://api.github.com/users/diosmosis/events{/privacy}","received_events_url":"https://api.github.com/users/diosmosis/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/piwik/piwik/milestones/79","html_url":"https://github.com/piwik/piwik/milestones/2.14.0","labels_url":"https://api.github.com/repos/piwik/piwik/milestones/79/labels","id":1005076,"number":79,"title":"2.14.0","description":"","creator":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"open_issues":49,"closed_issues":94,"state":"open","created_at":"2015-03-04T03:03:44Z","updated_at":"2015-06-02T19:48:13Z","due_on":"2015-06-02T12:00:00Z","closed_at":null},"comments":42,"created_at":"2011-01-21T02:50:45Z","updated_at":"2015-06-03T04:29:59Z","closed_at":null,"body":"Currently, the last page view is set with a 'time on page' of zero seconds. \n\nInstead, we could regularly ping the Piwik server with a request that notifies Piwik that the user is still on the website.\n\nThis request should not record new page view, only increase the visit_total_time counter.\n\nAlso, we should only throw this request when the user is actually looking at the page, not doing something else in some other tabs. \n\nThe 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.\n\nOf course, we should not make everything slow by adding handlers on mouse move, etc.\n\nAlso, 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.\n"},"comment":{"url":"https://api.github.com/repos/piwik/piwik/issues/comments/108187137","html_url":"https://github.com/piwik/piwik/issues/2041#issuecomment-108187137","issue_url":"https://api.github.com/repos/piwik/piwik/issues/2041","id":108187137,"user":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T04:29:59Z","updated_at":"2015-06-03T04:29:59Z","body":"Summary of discussion so far:\r\n* piwik.js:  `sendRequest` mechanism can be reused\r\n* need to decide on \"ping\" strategy eg. ping first time after 20s, then ping less and less often eg. [20, 40, 60, 100, 160, 260, ....]  ?\r\n* we need to ping only when the page is actively viewed (we need to detect active tab/window somehow, maybe Page Visibility API can do this?)\r\n* define & document a new Tracking API parameter, eg `ping=1`\r\n\r\nMaybe you have more thoughts, cc @diosmosis "}}