Hey guys, I’m working on a custom report (which involves going straight to the DB), and I’m trying to figure out some potential inconsistencies with the way piwik is logging data. I have the following four rows of data from log_visit from the same visitor:
Basically, it’s the same user, but visitor_returning is only marked as “1” for the second visit, and not for the 3rd and 4th visit. I would also expect the days since first and last visit to be different (for example, instead of 22 for the last row, I’d expect visitor_days_since_last to be 13 - the # of days from 07/18 to 08/01)
Heya, thanks for all your responses. I hope you can indulge me with one more answer to one more question
To perhaps clean up this minor discrepancy on my end in the Piwik code, I was thinking about a few different solutions.
The first way I was thinking is to modify Piwik_Tracker_Visit’s handleNewVisit method. I’m running 1.8.4, and there’s a bit of code that puts info into the visitorInfo array; notably this line in handleNewVisit() :
… so this will make it so that a visitor is marked as a returning visitor if visitor_days_since_last is greater than 0.
The second approach I thought about was just making a custom plugin that implements the Tracker.newVisitorInformation event hook (and just modify the referenced $notification object). I thought this way might be cleaner, since I try to avoid modifying piwik core code when I can.
Anyway, I guess my question is: am I missing anything here (if there are more areas I’ll need to change), and am I approaching this correctly?