@hmage opened this Issue on October 10th 2014

After adding the content impression, my visitor log got spammed with "0 Action" entries.


I don't think this is intended, so I'm opening an issue.

Images with links are marked something like this:

<a target="_blank" href="images/image-104.jpg" data-track-content 
   data-content-name="Image <a href='/104'>#104</a>">
<img src="images/image-104-thumb.jpg" alt="Image <a href='/104'>#104</a>" data-content-piece/>
@mattab commented on October 10th 2014 Member

Thanks for the report!


  • multiple visits are created when tracking Contents views, instead of tracking all views in the same visit.

Note: I also created a new issue after seeing the screenshot: Content-tracking: display content views and interactions in the Visitor log #6416

@tsteur commented on October 12th 2014 Member

This should be fixed in #6296

@mattab commented on October 12th 2014 Member

@hmage please test with latest Piwik beta version: http://piwik.org/faq/how-to-update/faq_159/

If you still experience the issue please reopen this ticket! thanks for your tests.

@hmage commented on October 12th 2014

Will test tomorrow. Is there a way to clean up the data that already got into the system?

@hmage commented on October 12th 2014

Ok, after installing and updating — I still get “0 action” events, but far less frequently.

Don’t have access to reopen the ticket. So commenting here with hope that you’ll notice this and reopen it.

screen shot 2014-10-13 at 03 16 48
screen shot 2014-10-13 at 03 17 35

@mattab commented on October 13th 2014 Member

Ah bummer the bug is not fixed

@hmage commented on October 13th 2014

After some digging — now it happens once per user. To force the “0 Action” I need to clear out the cookies and visit the site again.

@hmage commented on October 13th 2014

Also, will be there a way to cleanup the generated events? Maybe some mysql query that I can run manually?

@mattab commented on October 14th 2014 Member


  • this bug should only occur in a small percentage of cases.
  • unfortunately so far I can't think of any solution to the problem of multiple tracking requests in the same second causing multiple visits.
  • maybe the easiest way is to implement queue #6075 so that we can import all requests for a same { person / visitor / user } all at once?
@jochen42 commented on October 14th 2014

hi, i can also confirm this. i am just testing piwik parallel to GA. and i love it. :) but since i startet with content-tracking the visitors are not correct.
The queue solution #6075 sounds to very simple and sensefull.
But i have also the problem with that wrong visits.
When I execute the following SQL-Query, the result starts excatly at the time i first implemented content-tracking and the number of rows seems to be correct. (estimated)

SELECT * FROMlog_visitWHEREvisit_total_actions=0 ORDER BYlog_visit.visit_first_action_timeASC

So for me it could be a solution to execute something like this:

DELETE FROMlog_visitWHEREvisit_total_actions=0 AND visit_first_action_time BETWEEN <start of content tracking> AND <end of content tracking>

But i don't know if this can corrupt something else.

SORRY that was a stupid proposol. know i know how your the database works. its definetly more complicated.

@jochen42 commented on October 14th 2014

one more thing, i just have seen, that no new empty visits are generated sind update to 2.8.0.

@tsteur commented on October 14th 2014 Member

@jochen42 I just had a look and the query you suggest looks good! As always before deleting any data make a possible ;)

After deleting this data you might have to invalidate archived data so that the reports are reprocessed with the next cronjob or Piwik page request. There is a little FAQ explaining how to do it: http://piwik.org/faq/how-to/faq_155/
Just separate the dates you want to re-archive with a comma. You'll get the token by going to Piwik => Settings Menu => API

@jochen42 commented on October 14th 2014

@tsteur thx for that nice advice ;)

i just reprocessed the data, this afternoon, but this will not solve the problem of wrong visits, because the visits are generated directly.
at the 24 of the last month i integrated some content tracking. since this time i have more number of visits but not mor number of unique visitors. so i checked this tracker and identified, that the content-tracking caused this problem. some days later i added mor content tracking and the difference to realistic visits grows extremly. now we have 5 times more visits then before.

as you can see in the attached screenshot, piwik created three visits for the same visitor at the same second. but this table (log_visit) is (as i understand) the basic-data for the reports. so reports wan't change after reprocessing. i tested this already.

in my opinion, this problem should have everybody who uses content-tracking with Version 2.7.0 and it can not be solved with reprocessing.

this zero-action visits has log_visits.total_actions = 0, but there are referenced rows in log_link_visit_action.

i think a script is needed, which identifies the zero-action visits and tries to move the actions to the correct visit and then delete the zero action visits.

i am totaly new at the db-architecture of piwik, so tell me if i am wrong.
but currently we have 2 weeks of wrong data, and i wan't to fix this.

also i am total new at piwik development, but if i can help something, please tell me.

bildschirmfoto 2014-10-14 um 21 03 07

@tsteur commented on October 14th 2014 Member

We'd need to wait till Friday to see if we'd write a script for this. This SQL should select or delete all the rows from visit and action table and should do the trick. Unfortunately, I cannot test it as I have only a few empty visits here.

SELECT * FROM piwik_log_visit v, piwik_log_link_visit_action a where v.idvisit = a.idvisit and v.visit_total_actions = 0;
DELETE FROM piwik_log_visit v, piwik_log_link_visit_action a where v.idvisit = a.idvisit and v.visit_total_actions = 0;

Writing a script to fix it is maybe not that easy. You'd probably have to find all visit entries having 0 visits (visit_total_actions=0). For each idvisit you found have a look if there is another visit entry having same idvisitor and config_id within like 2 min time range (use visit_first_action_time to compare). If there is no same idvisitor and config_id entry then delete the visit. If there is one merge it with one visitor that has at least one action (visit_total_actions>=1).

To merge you'd basically run an update on each entry in the action table like (update piwik_log_link_visit_action SET idvisit = newIdvisit where idvisit = oldIdVisit). You won't have to increase visit_total_actions as content impressions do not count as an action.

Something like this should work

@jochen42 commented on October 14th 2014

@tsteur THX!
sounds good. tomorow i will test this.
if it is working (i can test on 300k 0-action visits), should it create a pull request or something else to share?

@tsteur commented on October 14th 2014 Member

Maybe create a gist and paste a link here? Not sure if we would ship it with Piwik itself as it would be probably only used for this case.

@jochen42 commented on October 17th 2014

Yesterday i wrote a small command for database cleanup.
After many hours of running, the result seems to be good.
so in my case it works, a think nobody should use this in a live enviroment.

here is the gist-link: https://gist.github.com/anonymous/33a508c14f19d2b78e9d

thx again, jochen

@tsteur commented on October 20th 2014 Member

Great work, thx for that!

@mattab commented on April 7th 2015 Member

@tsteur what do you think is the status & next step of this Bug?

@tsteur commented on April 7th 2015 Member

From my point of view it can be closed. You wanted to leave it open so users can find it

@mattab commented on November 25th 2015 Member

The bug is still actually live, leaving opened

WORKAROUND: use QueuedTracking plugin with Redis should fix this issue: http://plugins.piwik.org/QueuedTracking

@jcm77 commented on November 26th 2015


after implementing content tracking I started to get visits with 0 Actions and my Bounce Rate is being seriously affected. I´m using the 2.15.0 Version and the issue is still there.
I will see if this http://plugins.piwik.org/QueuedTracking works.



@jcm77 commented on December 2nd 2015

Hi Matt,

we installed the plug-in and unfortunately we still have the problem. We keep looking for ways to solve the issue, one of them could be to disable the content tracking and see if the problem persists.

I will let you know if we can solve it



@hpvd commented on July 15th 2016

hmm is there any news/solution on this?
would be awesome to share it here.

@tsteur commented on July 17th 2016 Member

The only known workaround is to use the QueuedTracking plugin see https://github.com/piwik/piwik/issues/6415#issuecomment-159448227

@huang0808 commented on July 26th 2018

@tsteur I meet this issue, when I update to 3.4.0. show many 0 action. and In my develop server, it is not many request, but it still show 0 action. Have you help me see the issue?


Sophie Wang

@tsteur commented on July 26th 2018 Member

See one comment above. Give the plugin Queued Tracking a try. It is now easy to set it up and likely fixes all the issues.

@tsteur commented on August 17th 2019 Member

I haven't over all the comments but wouldn't a similar solution that we do to avoid duplicate actions do?

  • Like we insert the visit
  • then we select like all visits that were created in the last 1 min matching the config_id or the visitor_id (depending on the config settings, config_id match has index and is fast anyway)
  • we only keep the visit with the lowest id or so.

Haven't thought much about it though but something like this could work here too? But of course it be another select for new visits. @mattab

@mattab commented on October 21st 2019 Member

Haven't thought much about it though but something like this could work here too? But of course it be another select for new visits. @mattab

This might work :+1:

This issue is valuable because ideally we wouldn't want people to have to use QueuedTracking to solve an issue.

Powered by GitHub Issue Mirror