PHP Tracker reports not processing


#1

I have read through the doc and did a search on the site. Read other forum post and am finding nothing. I am using the PHP Tracker API to import data from a past experience. All the actions were logged in another database and I am pulling it out and then inputting it into piwik with the API.
This is the general set up :


public function add_pageview_to_piwik($params){
        $this->t->setUserAgent( "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB) Firefox/3.6.6");
        $this->t->setBrowserLanguage('en-us');
        $this->t->setBrowserHasCookies(false);
        $this->t->setResolution( 1024, 768 );
        $this->t->setPlugins(false,true);
        $this->t->setLocalTime( $params['localTime'] ); //'H:M:S"
        $this->t->setTokenAuth( $this->piwik_token );
        $this->t->setIp( $params['ip'] );
        $this->t->setUrlReferrer( $params['urlReferrer'] );
        $this->t->setForceVisitDateTime( $params['visitTime'] ); //'2011-04-05 23:55:02'
        $this->t->setUrl( $params['url'] );
        $this->t->setVisitorId( $params['visitorID'] );
        $this->t->setCustomVariable( 1, 'stage', $params['stage'] );
        $this->t->setCustomVariable( 2, 'weekday', $params['weekday'] );
        if("Send" == $params['stage']){
            $this->t->setCustomVariable( 3, 'allowLibrary', $params['allowLibrary'] );
            if(!empty($params['videoImpressions'])){
               $this->t->setCustomVariable( 4, 'videoImpressions', $params['videoImpressions'] ); 
            }
            if(!empty($params['videoViews'])){
                $this->t->setCustomVariable( 5, 'videoViews', $params['videoViews'] );
            }
        }
        $response = $this->t->doTrackPageView( $params['title'] );
        fwrite($this->fp_response, $response); 
    }

on the last lines i am putting the response into a file to see what it is. This is what i am seeing repeated again and again in the file "


GIF89a^A^@^A^@<80>^@^@^@^@^@^@^@^@!ù^D^A^@^@^@^@,^@^@^@^@^A^@^A^@^@^B^BD^A^@;

"

This is basically all from a touch screen interface on an application. So i am setting the visitor id to a new id when i realize that a new person has started the process. it is just 1000000000000000 (16 char) which just gets incremented by 1 every time it is a new user.

I have the params values printed out everytime. one of which looks like this :


---------------------------------------------Array
(
    [urlReferrer] => http://messagetogothamkiosks.com
    [ip] => 75.204.74.22
    [visitTime] => 2012-06-06 19:10:23
    [localTime] => 19:10:23
    [url] => http://messagetogothamkiosks.com/Catwoman
    [stage] => Catwoman
    [weekday] => Wednesday
    [title] => Catwoman | Message to Gotham Kiosks
    [visitorID] => 1000000000000002
)

or


---------------------------------------------Array
(
    [allowLibrary] => 0
    [videoImpressions] => 0
    [videoViews] => 0
    [urlReferrer] => http://messagetogothamkiosks.com/Batman/Info/Record/Share
    [ip] => 75.204.74.22
    [visitTime] => 2012-06-11 16:34:01
    [localTime] => 16:34:01
    [url] => http://messagetogothamkiosks.com/Batman/Info/Record/Share/Send
    [stage] => Send
    [weekday] => Monday
    [title] => Send | Share | Record | Info | Batman | Message to Gotham Kiosks
    [visitorID] => 1000000000000005
)

This function is hit 1000x in a batch. I have a usleep(200) at the end of each entry to slow it down a little bit. and it is also slowed down a little bit because it is pulling together other things (like other apis to make this entry.

there are the correct amount of entries in piwik_log_link_visit_action. But none of the reports have anything. i tried calling the archive.php manually with my token in the url string but it never says that there are files to process. I put in test user generated data from the core plugin and that works fine. Not sure if maybe because the visitor log in date, which i have set is so long ago (feb-apr) that piwik is not catching them and making reports from them.

i have executed this from the command line and the browser both without it timing out (because i am only doing 1000 at a time). i also have waited over night to see if the reports just needed time to get done.

There is also a small thing where it is possible to have like 100 different visitors from the same ip, one after another (because it is a standing kiosk in a public area) and i have that delineated by setting explicitly the visitor id but it doesn’t seem to be loyal to my input, as it has (in the visitor log) some visitors to have 300 actions etc. Because it is possible for there to be a 40 sec difference in times and have it be a different visitor (as I have set in the id).

I will most definitely provide any more information that might help. I have come at this from whatever angle I can think of.


(Matthieu Aubry) #2

If you import data in the past, you need to also tell Piwik that data is now avaialble to old dates.
See faq: How to - Analytics Platform - Matomo


#3

Matt, You are a saint among men.

No doubt i would have never seen this (for some reason).

Any experience with having different visitor id’s be lumped together because of them having a very close IP and time?


(Matthieu Aubry) #4

Any experience with having different visitor id’s be lumped together because of them having a very close IP and time?

Do you use the parameter “cid” to force the visitor ID?


#5

i am using


$this->t->setVisitorId( $params['visitorID'] );

with something similar to :


[visitorID] => 1000000000000005


#6

It might be on my end. I am going to look more into it and will submit something more specific if i find out it not to be an error or mine


#7

Ok so here is the issue :


Request will be recorded for this idvisitor = 1000000000000113
Matching visitors with: visitorId=1000000000000113 OR configId=db19d9d6f1ed3b00
The visitor is known (idvisitor = 1000000000000112, config_id = db19d9d6f1ed3b00, idvisit = 56, last action = Sat, 23 Jun 2012 17:22:57 +0000, first action = Sat, 23 Jun 2012 17:22:01 +0000, visit_goal_buyer' = 0)
Visit is known (IP = 75.204.74.22)
Updating existing visit: array ( 'visit_exit_idaction_url' => 2, 'visit_exit_idaction_name' => 1, 'visit_last_action_time' => '2012-06-23 17:24:04', 'visit_total_time' => 124, 'idvisitor' => '1000000000000112', 'visit_goal_buyer' => '0', 'custom_var_k1' => 'stage', 'custom_var_v1' => 'Start', 'custom_var_k2' => 'weekday', 'custom_var_v2' => 'Saturday', 'custom_var_k3' => 'allowLibrary', 'custom_var_v3' => '0', 'custom_var_k4' => 'videoImpressions', 'custom_var_v4' => '1', 'custom_var_k5' => 'videoViews', 'custom_var_v5' => '1', )

i don’t see a method in the php tracker that lets you update the cid. I know you can do it by querying the api directly but that is a whole different method right? that should be encompassed in the php wrapper. Also there doesn’t seem to be the “enableBulkTracking ()” or the " doBulkTrack ()" methods on that php wrapper that you download at "http://demo.piwik.org/index.php?module=SitesManager&action=downloadPiwikTracker&idSite={%24IDSITE}&piwikUrl=http%3A%2F%2Fdemo.piwik.org%2F"
And it is not in the API that comes with the latest version of piwik : “libs/PiwikTracker/PiwikTracker.php”

Thanks for all your help


(Matthieu Aubry) #8

Please try this to force piwik to use visitor ID: How to - Analytics Platform - Matomo

Bulk tracking: we updated doc too early, feature not yet available in released but only on SVN


#9

You sir. Have done it again.

I will look out for the batch methods in the future.

Thanks alot, you have save me, and those depending on me, countless hours.


(Matthieu Aubry) #10

bulk tracking is now released in 1.8.3 beta which you can use already if you wish, info at: 301 Moved Permanently

if we saved you hours and you are confidently setup in life please consider making donation :wink: http://piwik.org/contribute/


#11

ill see what i can do sir.