Skip to content

Make sure ping=1 does not create duplicated actions #8218

@tsteur

Description

@tsteur

Recently we implemented new tracker feature ping=1 in #8069 .

While reading #8202 I noticed there might be a problem with the implementation of ping request during tracking. Problem might be in Visit.php here: https://github.com/piwik/piwik/pull/8069/files#diff-9bca48e482124d44a3d910acc809194eR168

Imagine a ping request is sent and a new visit is detected. This can happen for many reasons, eg it is now after midnight, no ping was sent for last 15 minutes and user configured a shorter "timeout", a custom dimensions causes a new visit etc.

In this case we might track the same action again as it never goes in if !$isNewVisit. It is a new visit and therefore we create a new visit including action etc for this ping request but I reckon it should not?

A solution could be to do something like

if ($this->isPingRequest() && $isNewVisit) {
   return; // do not track anything?
} else if ($this->isPingRequest() && !$isNewVisit) {
  $action= null;
}

I'm not sure about expected behaviour in this case and wasn't sure if I should comment on already merged PR or not. So created this issue. Feel free to close if it is invalid

@mattab @diosmosis

Metadata

Metadata

Assignees

Labels

BugFor errors / faults / flaws / inconsistencies etc.not-in-changelogFor issues or pull requests that should not be included in our release changelog on matomo.org.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions