So,
I went to the link you gave me http://piwik.org/docs/tracking-api/reference/
I set $GLOBALS[‘PIWIK_TRACKER_DEBUG’] = true; in piwik.php
The http requests to piwik.php by visiting a page that has the js tracking code in the end of the body is only 1 request and is as follows as shown in firebug:
Cache-Control no-cache, private, no-transform, must-revalidate, proxy-revalidate, post-check=300, pre-check=300, max-age=300
Connection Keep-Alive
Content-Encoding gzip
Content-Type text/html
Date Thu, 05 Sep 2013 03:47:13 GMT
Keep-Alive timeout=5, max=99
Pragma no-cache
Server Apache/2.2.22 (Ubuntu)
Transfer-Encoding chunked
Vary Accept-Encoding,User-Agent
Request Headersview source
Accept image/png,image/*;q=0.8,*/*;q=0.5
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection keep-alive
DNT 1
Host stats.dev.ubuntu
Referer http://dev.ubuntu/software/tests/test
User-Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
or
GET /piwik.php?action_name=testing&idsite=1&rec=1&r=806821&h=6&m=47&s=13&url=http%3A%2F%2Fdev.ubuntu%2Fsoftware%2Ftests%2Ftest&urlref=http%3A%2F%2Fdev.ubuntu%2Fsoftware%2Ftests&_id=8b528b7540f3a728&_idts=1378348605&_idvc=1&_idn=0&_refts=0&_viewts=1378348605&pdf=0&qt=1&realp=0&wma=1&dir=0&fla=1&java=0&gears=0&ag=0&cookie=1&res=1920x1080>_ms=810 HTTP/1.1
Host: stats.dev.ubuntu
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: http://dev.ubuntu/software/tests/test
Connection: keep-alive
The HTML tab or if I run the URL request on browser I get this:
Debug enabled - Input parameters: <br/>array ( 'action_name' => 'testing', 'idsite' => '1', 'rec' => '1', 'r' => '556146', 'h' => '7', 'm' => '7', 's' => '8', 'url' => 'http://dev.ubuntu/software/tests/test', 'urlref' => 'http://dev.ubuntu/software/tests', '_id' => '8b528b7540f3a728', '_idts' => '1378348605', '_idvc' => '1', '_idn' => '0', '_refts' => '0', '_viewts' => '1378348605', 'pdf' => '0', 'qt' => '1', 'realp' => '0', 'wma' => '1', 'dir' => '0', 'fla' => '1', 'java' => '0', 'gears' => '0', 'ag' => '0', 'cookie' => '1', 'res' => '1920x1080', 'gt_ms' => '646', )
Loading plugins: { Provider,Goals,UserCountry }
Current datetime: 2013-09-05 04:08:37
(this is not a Site Search request)
Excluding parameters "aaaaaa,bbbbbb" from URL
Action is a Page URL, Action name = testing, Action URL = http://dev.ubuntu/software/tests/test
Piwik_Cookie::__set_state(array(
'name' => '_pk_uid',
'expire' => 1441426117,
'path' => '',
'domain' => '',
'secure' => false,
'httponly' => false,
'value' =>
array (
),
'keyStore' => false,
))
Matching visitors with: visitorId=8b528b7540f3a728 OR configId=653ff52fe8d942d1
The visitor is known (idvisitor = 1261a5ce0a1facc5, config_id = 653ff52fe8d942d1, idvisit = 111, last action = Thu, 05 Sep 2013 04:08:21 +0000, first action = Thu, 05 Sep 2013 02:35:41 +0000, visit_goal_buyer' = 0)
Visit is known (IP = 192.168.1.140)
Updating existing visit: array ( 'visit_exit_idaction_name' => 142, 'visit_exit_idaction_url' => 131, 'visit_last_action_time' => '2013-09-05 04:08:37', 'visit_total_time' => 5577, 'idvisitor' => '1261a5ce0a1facc5', 'visit_goal_buyer' => '0', )
array (
'idvisit' => '111',
'idsite' => 1,
'idvisitor' => 'a¥Î
',
'server_time' => '2013-09-05 04:08:37',
'idaction_url' => '131',
'idaction_name' => 142,
'idaction_url_ref' => '131',
'idaction_name_ref' => '142',
'time_spent_ref_action' => 16,
'custom_float' => 646,
)
Piwik_Cookie::__set_state(array(
'name' => '_pk_uid',
'expire' => 1441426117,
'path' => '',
'domain' => '',
'secure' => false,
'httponly' => false,
'value' =>
array (
),
'keyStore' => false,
))
-> Scheduled tasks not triggered.
Next run will be from: 2013-09-05 04:47:13 UTC
Nothing to notice => default behaviour
End of the page.
array (
)
Piwik_Timer::__set_state(array(
'timerStart' => 1378354117.6629,
'memoryStart' => 2539416,
))
For some reason the time is wrong although I use a special php.ini for piwik and each site on this server and date.timezone is set. The time in piwik stats though is fine.
I cut an image and looks like this – see below. Ignore the last pink folder that looks like a visit on the lower line, that is because I was testing pageview in the php application. Also it looks like there is a time difference just because I made lots of refreshes on the page without hitting the download button for a long time:
Now the page you gave me says:
If the requests are triggered from your app or software directly, you can output or log the Tracking URL piwik.php?… and manually load it to view the logging messages.
As I showed you in my first post, I am communicating with piwik to send the download event using that php code. I am not making any http requests, nor I have set an image to track the downloads.
What I actually do is the following:
- Once the download button exists on the page, when pressed I do:
header('Location: '.$download_url.'&site_button=1');
exit;
- In the download app, when the .$download_url is found to exist, I check if the ‘site_button’ variable is set, if yes, before I give the file using readfile() I run the code I showed you to send the download event to piwik.
So I cannot understand how to debug this.
I also cannot understand why it is stored as a different visit while the IPs are the same and the time difference is like some seconds later. Maybe cause there is no cookie in the second case ?
Also, while I was testing something different I had the same effect. If I disable javascript on browser and the image part of the code triggers the visit, it also does the same exactly thing, it splits it as a separate visitor and not in the same line of events. If I put back javascript on the browser, it also continues the visits of the other visitor from the same IP. So even if it is me on the same computer and browser and without much delay. if I switch the javascript setting I am 2 different visitors. But this doesn’t bother me at all once none is going to do this on a live website.
Any ideas what to do with the download issue ?
Thank you !
EDIT 1:
This is a lan server but setup similar to the online one and the online website behaves exactly the same with the downloads.
By the way, a lan IP shows USA flag heh
EDIT 2:
It might sound unbelievable but I just had a visitor that switched their javascript setting on/off and also made a download. His no-javascript visit was in the same line of actions as his downloads. He wasn’t split into 3 visitors.
EDIT 3:
I tested without javascript and when I visit the page and then download the visit does not get split into 2.
I am trying to figure out what variable is missing and I could send to the downlaod script.