Title: Implement PHP Tracker API
Last modified: August 21, 2016

---

# Implement PHP Tracker API

 *  Resolved [Dr. Ronny Harbich](https://wordpress.org/support/users/raubvogel/)
 * (@raubvogel)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/implement-php-tracker-api/)
 * Hi, braekling,
 * I like your plugin – it’s nice help for Piwik. But I have a problem: I don’t 
   want to track users by JavaScript or Image. Piwik has an alternative: [Piwik Tracking API (Advanced users)](https://piwik.org/docs/tracking-api/#toc-piwik-tracking-api-advanced-users)
 * It’s a PHP class (PiwikTracker.php) that has to be called if a page is loaded.
   Do you think you can add this feature to your great plugin? If you want I can
   do the implementation too and create a SVN patch.
 * I will give a basic implementation:
 *     ```
       // write log to piwik
       $t = new PiwikTracker(SITE_ID));
   
       // optional tracking
       $t->setUserAgent(self::validString($_SERVER['HTTP_USER_AGENT'], false));
       $t->setUrlReferrer(self::validString($_SERVER['HTTP_REFERER'], false));
       //$t->setBrowserLanguage('de');
       //$t->setLocalTime( '12:34:06' );
       //$t->setResolution( 1024, 768 );
       //$t->setBrowserHasCookies(true);
       $t->setCustomVariable(2, 'httpStatus', $httpStatus);
       //$t->setPlugins($flash = true, $java = true, $director = false);
       $t->setTokenAuth(PIWIK_AUTHTOKEN));
       $t->setIp(self::validString($_SERVER['REMOTE_ADDR'], false));
       $t->setForceVisitDateTime('now');
   
       // TODO: $_SERVER['SERVER_PROTOCOL'] return http only never https
       // mandatory
       $t->setUrl(self::validString('http://' . MY_DOMAIN . $_SERVER['REQUEST_URI'], false));
       $t->doTrackPageView(CURRENT_PAGE_TITLE);
       ```
   
 * [http://wordpress.org/plugins/wp-piwik/](http://wordpress.org/plugins/wp-piwik/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/implement-php-tracker-api/#post-4348568)
 * PHP API is supported since 0.9.4, currently still implemented as “BETA”. See 
   tracking settings.

Viewing 1 replies (of 1 total)

The topic ‘Implement PHP Tracker API’ is closed to new replies.

 * ![](https://ps.w.org/wp-piwik/assets/icon-256x256.png?rev=3529668)
 * [Connect Matomo - Analytics Dashboard for WordPress](https://wordpress.org/plugins/wp-piwik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-piwik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-piwik/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-piwik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-piwik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-piwik/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [braekling](https://wordpress.org/support/users/braekling/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/implement-php-tracker-api/#post-4348568)
 * Status: resolved