• Resolved Dr. Ronny Harbich

    (@raubvogel)


    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)

    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('https://' . MY_DOMAIN . $_SERVER['REQUEST_URI'], false));
    $t->doTrackPageView(CURRENT_PAGE_TITLE);

    https://www.ads-software.com/plugins/wp-piwik/

Viewing 1 replies (of 1 total)
  • Plugin Author braekling

    (@braekling)

    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.