matomo-org / plugin-TrackingSpamPrevention

GNU General Public License v3.0
12 stars 7 forks source link

When max actions feature enabled and limit reached, delete the current visit #4

Open tsteur opened 3 years ago

tsteur commented 3 years ago

Say someone configures max 100 actions per visit to be allowed, and the current visit reached > 100 actions, then we block this IP for future tracking requests for up to 24 hours.

We could also directly delete this visit (and potentially delete all visits from that IP from the same day). It be easy to develop but not doing it for now as you could misuse it potentially to delete visits if eg HTTP headers are used to detect IP etc. It may be fine though maybe when no proxy headers are used or so.

Depending how often this happens could also include a link in the email to the visitor profile or so and then user could decide to delete that visit once this feature is available. Requires manual work though.

AJHoeh commented 3 years ago

We could also directly delete this visit

I think that is the most important part and would be a great enhancement, if unsure maybe implement as an optional setting :)

tsteur commented 3 years ago

fyi I just realise it may be difficult to delete the visit automatically. Like what would potentially happen is:

To prevent this problem we could instead delete visits in a task say every X hours or once a day and only delete "finished visits" where the last action was more than 30 minutes ago (or whatever is configured as visit length for creating new visits). This way it be also generally better because it would mean we wouldn't need to invalidate existing reports every time a single visit is deleted.

Alternatively, we could of course do a soft delete but this would require a DB schema change on the log table which we do only for major release updates because they take so long. Yet another way be to put configId/visitorId temporarily on a "not allow" list