1.5.1 Wrong number of visits and (unique) visitors


(Jürgen) #1

Hi, i just updated my piwik from 1.1.1 to 1.5.1 and having problems with number of vists and visitors.

Each time i send a tracking request (with firefox 5) piwik increases the number of pages, vists and visitors. That will be ok for my first request, but all of my following requests should only increase the number of pages, not visits or visitors.
Same request in IE9 increases the pages and visits. The number of visitors looks fine and increases only for the first request.

As i see in the tracking request, the value of the cookie piwik_visitor is always the same, so i dont know why there is a new visit every time i call a new page.

I'm using the async tracking and this is what's defined in my pages:
var piwikSiteId = '2';
var _paq = _paq || [];
(function(){
var u="https://piwik.mydomain.net/piwik/";
_paq.push(['setSiteId', '2']);
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
var d=document,
g=d.createElement('script'),
s=d.getElementsByTagName('script')[0];
g.type='text/javascript';
g.defer=true;
g.async=true;
g.src=u+'piwik.js';
s.parentNode.insertBefore(g,s);
})();
Piwik is installed under a subdomain like piwik.mydomain.net and the site is available under website.mydomain.net. I think this should be no problem!?
It looks like a cookie problem for me but i'm not sure.

Maybe someone can help - where do i have to look solving this issue?

Thanks,
JJ


(Matthieu Aubry) #2

Hello

thanks for the report. Make sure you delete cookies then try again, is it better?
if you try in another fresh IE9 can you replicate the issue on all IE9?

If yes, then please create a ticket at dev.piwik.org and we will investigate for sure

thanks


(Jürgen) #3

Hi Matt,

the behaviour in a clean ie9 is the same as in firefox, so the number of pages, visits and visitors will be increased at any page load.

The issue is, that the number of visits and visitors should only be increased at first page load. Maybe you can tell me which values of the cookie should be changed while sending a tracking request?

This is a sample _pk_id Cookie value:
709544147ab6df5c.1312470638.3.1312536961.1312530066.

After reloading the page, the cookie looks like this:
709544147ab6df5c.1312470638.3.1312536973.1312530066.

The only different is in the timestamp of the current visit. I’m not sure if the timestamp of the last visit should change too?


(vipsoft) #4

if the problem is in firefox, check your addons


(Matthieu Aubry) #5

Jürgen, can you please enable DEBUG as explained in: Tracking API - Analytics Platform - Matomo

Then, can you please install FIREBUG FF extension and then look at the NET panel to see the HTTP request to piwik.php?..

When you open this in a new tab you will see the DEBUG message. Please copy it here, and if possible send the URL to the page containing your test JS code so we can try and replicate it on your server? thx


(Jürgen) #6

@Anthon: The problem is not a firefox problem, it seems to be a general problem in our piwik installation or configuration.

@matt: this is my debug output:

Debug enabled - Input parameters:
array (
'action_name' => 'Login',
'idsite' => '2',
'rec' => '1',
'r' => '711943',
'h' => '10',
'm' => '7',
's' => '28',
'url' => 'http://mydomain.net/login',
'urlref' => 'http://mydomain.net/login',
'_id' => '70f7e34b16d18fa5',
'_idts' => '1312788759',
'_idvc' => '2',
'_idn' => '0',
'_refts' => '0',
'_viewts' => '1312788759',
'pdf' => '0',
'qt' => '1',
'realp' => '0',
'wma' => '1',
'dir' => '0',
'fla' => '1',
'java' => '1',
'gears' => '0',
'ag' => '0',
'res' => '1600x1200',
'cookie' => '1',
)
Loading plugins: { Provider,Goals }
Current datetime: 2011-08-08 08:08:20
Action is a Page URL, Action name = Login, Action URL = http://madomain.net/login
COOKIE piwik_visitor, rows count: 0, cookie size = 0 bytes array ( )
The visitor has the piwik cookie (idvisitor = 70f7e34b16d18fa5)
The visitor was not matched with an existing visitor...
New Visit (IP = xxx.xx.xx.xx)

array (
'idsite' => 2,
'visitor_localtime' => '10:07:28',
'idvisitor' => 'c25d736abce057e5',
'visitor_returning' => 1,
'visitor_count_visits' => 2,
'visitor_days_since_last' => 0,
'visitor_days_since_order' => 0,
'visitor_days_since_first' => 0,
'visit_first_action_time' => '2011-08-08 08:08:20',
'visit_last_action_time' => '2011-08-08 08:08:20',
'visit_entry_idaction_url' => 22020,
'visit_entry_idaction_name' => 3,
'visit_exit_idaction_url' => 22020,
'visit_exit_idaction_name' => 3,
'visit_total_actions' => 1,
'visit_total_time' => '0',
'visit_goal_converted' => 0,
'visit_goal_buyer' => 0,
'referer_type' => 1,
'referer_name' => '',
'referer_url' => 'http://madomain.net/login',
'referer_keyword' => '',
'config_id' => '2bf5395fd2a5aa90e3de1c3760',
'config_os' => 'LIN',
'config_browser_name' => 'FF',
'config_browser_version' => '5.0',
'config_resolution' => '1600x1200',
'config_pdf' => 0,
'config_flash' => 1,
'config_java' => 1,
'config_director' => 0,
'config_quicktime' => 1,
'config_realplayer' => 0,
'config_windowsmedia' => 1,
'config_gears' => 0,
'config_silverlight' => 0,
'config_cookie' => 1,
'location_ip' => '�[',
'location_browser_lang' => 'de-de,de,en-us,en',
'location_country' => 'de',
'location_provider' => 'Ip',
)

array (
'idvisit' => '283511',
'idsite' => 2,
'idvisitor' => '�]sj��W�',
'server_time' => '2011-08-08 08:08:20',
'idaction_url' => 22020,
'idaction_name' => 3,
'idaction_url_ref' => 0,
'idaction_name_ref' => 0,
'time_spent_ref_action' => 0,
)

COOKIE piwik_visitor, rows count: 0, cookie size = 0 bytes array ( )
-> Scheduled tasks not triggered.
Next run will be from: 2011-08-08 09:00:31 UTC
Nothing to notice => default behaviour
End of the page.

array (
'MYSESSION' => 'ee07fe729db5eea21e636bf53659b3ae',
'PIWIK_SESSID' => '793dcb2fa96dcd57d4cf07cd519170ca',
)

Time elapsed: 5.090s

The problem seems to be somewhere in selecting the idvisitor. My id already exists in the database, but piwik didn't find it.

Sorry matt, the url can only be accessed from inside our network but the configuration looks like the one i already posted here.


(Jürgen) #7

There seems to be a problem in my config_id or the conversion (hex to bin or bin to hex).

If i comment these two lines in core/Tracker/Visit.php, the behaviour “is as expected”:


if(!$forcedVisitorId)
  {
    #$where .= ' AND config_id = ? ';
    #$bindSql[] = $configId;
  }

So the search of a existing config_id fails and the visitor could not be matched.

Any ideas?


(Jürgen) #8

Maybe my config_id (2bf5395fd2a5aa90e3de1c3760) should have 16 characters instead of 26?


(Jürgen) #9

I think the problem is solved.
If you’re using mbstring.func_overload and mbstring.internal_encoding ist set, the length of the bin2hex string differs. In my case there were 26 characters instead of 16.

so i used this settings in piwik.php:


ini_set('mbstring.func_overload','0');
ini_set('mbstring.internal_encoding', null);

I will check my piwik tomorrow - the first tests looked fine.


(vipsoft) #10

Thanks, this is now fixed in http://dev.piwik.org/trac/changeset/5086


(Jürgen) #11

I changed it in my Visit.php, everything looks great now! Thanks for your quick response :slight_smile:


(Matthieu Aubry) #12

wow that is a VERY interesting one, thanks for spotting it Jürgen!!