@tsteur opened this Issue on January 23rd 2016 Member

This is going to be a bit technical: So far, when a ping request is sent, the request processor unsets other actions to prevent them from being created here: https://github.com/piwik/piwik/blob/2.16.0-b6/plugins/Heartbeat/Tracker/PingRequestProcessor.php#L24-L29

However, the visit itself is still updated. This has many downsides and risks:

  • We don't really know what a ping request is actually supposed to do (updating visit_total_time)
  • A ping request will update any kind of visit fields unless we work around it like this https://github.com/piwik/piwik/pull/9617/files#diff-73996192b2fb6075808b45d6276c3264R54 in each individual dimension. This can cause many side effects like #9610
  • Other plugins cannot know whether a ping request is happening so on any ping request they might still write data. This is a bit hard to explain but it might cause already bugs. Eg in the code the PingRequestProcessor unsets an Action metadata so no entry in log_link_visit_action gets created. It does this also for some Goals metadata etc. However if we change somewhere something in the code and forget to update the ping processor, we will introduce new bugs. This might be already the case for any 3rd party plugins including the ones from Piwik PRO.
  • The API gets simpler as one only has to send something like &idSite=5&ping=1 (There's a chance it works already like this right now)

In general, the ping request processor should simply update visit_total_time and that's it. The ping request processor will only cause no bugs and side effects if it has no knowledge of any other plugins. With the current implementation, it has to know everything about all dimensions. This makes it a problem for Piwik PRO and 3rd party plugins but also when we change or add code.

@dukewa1 commented on May 9th 2017

I would really like to do a ping update for AMP. However, I don't know the actual Ping procedure. Is this done at the command line? Are there any "how to" articles?

@RMastop commented on May 9th 2017 Contributor

Hi @dukewa1,

The following link to the developer site will show you how to enable the feature:
https://developer.piwik.org/guides/tracking-javascript-guide#accurately-measure-the-time-spent-on-each-page

Powered by GitHub Issue Mirror