Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heartbeat / ping requests should only update visit_total_time #9626

Closed
tsteur opened this issue Jan 23, 2016 · 2 comments
Closed

Heartbeat / ping requests should only update visit_total_time #9626

tsteur opened this issue Jan 23, 2016 · 2 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@tsteur
Copy link
Member

tsteur commented Jan 23, 2016

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 total time of visit is not the sum of times of page visits #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.

@tsteur tsteur added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Jan 23, 2016
@mattab mattab added this to the Mid term milestone Mar 31, 2016
@dukewa1
Copy link

dukewa1 commented May 9, 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
Copy link
Contributor

RMastop commented May 9, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

4 participants