PHP Tracking API

I like the PHP Tracking API but I cannot get more details, is it possible to customize the script.

Also I m getting the same title on the reports due to this code.
$customTitle = ‘This title will appear in the report Actions > Page titles’.

Is it possible to get the current title in the report.

If API is not a good way to gather data then I ll go back to regular javascript code.

I am interesting in PHP Tracking API too.
But information about PHP Tracking is not understood.

The docs don’t have real working example how to use PHP Tracking API (HTTP Request ) as Javascript Tracking.

Javascript Tracking is easy - we copy code an insert to every page which we want track. And it working! All information collected in database (ip, referrers, provider and other).
But PHP Tracking (HTTP Request ) - don’t working properly.

What information provide doc for users?

  1. Upload PiwikTracker.php and add for first add php for API init:
    require_once “/path/to/PiwikTracker.php”;
    PiwikTracker::$URL = ‘’;

It’s prefect, all understand.

  1. For HTTP Request Method:
    a) $piwikTracker = new PiwikTracker( $idSite = {$IDSITE} );
    b) // Sends Tracker request via http
    $piwikTracker->doTrackPageView(‘Document title of current page view’);

WHY??? Why we must manually add Document Title?
In Javascript we correct manually Page Title? NOT! Script check Title, Referrers, ip and etc…
Why in Php Tracking we must add title? Php script must check self $_SERVER[‘HTTP_REFERER’], $_SERVER[‘REMOTE_ADDR’] and other parameters.

Now PHP Tracking with HTTP Request not work properly. And in ‘Tracking API - Analytics Platform - Matomo’ we can’t find really work example…

Will waiting…

Anybody know working example for Php tracking?

P.S. If you have a lot of sites/blogs - javascript code is not good idea for SEO.

The document title is not available in PHP as it is part of the HTML DOM tree so you have to set a fake document title (you can also set ‘’ empty string)

If you have a lot of sites/blogs - javascript code is not good idea for SEO

Thanks Harold for your answers!

About Title i understand,
But why php tracking can’t define right ip address?

Now i test php tracking on different hosting and it define ip where my site hosted… but not referrer ip, as in JavaScript Tracking…

Any update?

Hi saudigbal,

Please check the forum history.

Maybe the following link is helpful for you.

Piwik 1.8 TrackerApi (PiwikTracker.php) don’t record the ClientIP correctly

Does the client IP recording don’t work with the PHP Tracking Api, or with the javascript tracking code?

I think I got it now, I had so set the auth key

$token_auth = ‘c95f3450afd18313207f86d5xxxxxxx’;