Piwik API setVisitorId not stores into DB


I have integrated piwik with use of php API and it works OK except one think which is custom id not stores into database, piwik generates its own “setVisitorId” code. my code is:

$t = new PiwikTracker( 2, 'http://site.com/piwik');
$t->setTokenAuth( 'codes' );
$t->setIp( $_SERVER['REMOTE_ADDR'] );
$t->setUrl( "http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI] );

                     $t->setVisitorId( "66200c7d6e4ec962" );
$t->setUserAgent( @$_SERVER['HTTP_USER_AGENT']);

please let me know what could be the reason for this.

Thanks in advance.


did you resolve this issue?

piwik (1.12) keeps assigning the visits to servers-ip and not the visitor set with setVisitorId

what exact code do you use? it should work if calling setVisitorId() and setTokenAuth() to authenticate, in 1.12 release ?


last night I figured out the setTokenAuth.

The manual depicts that the setTokenAuth is required for the setip so I added both setIp and setTokenAuth on the fly solving the setVisitorId.

Later I found a remark about setTokenAuth required for setVisitorId in the code of the PiwikTracker.php the quide didn’t mention that or I missed it

There is still something odd, I have blocked my webclient thru the dashboard using a cookie. Pageviews do not show up ( in the real time visitors widget) however ‘goals’ set using PiwikTracker do show up with the webservers ip address (79.170). Even with the ip set to the clients one (84.84)

PiwikTracker request:
see attachment for visitors log. [attachment 1301 Piwik.png]

thanks for your time