Daily using/supporting

Get Firefox browser!
Get Thunderbird!
Get Opera browser!
Get The Gimp!
Get Inkscape!
Get LibreOffice!
Get Videolan!
Get Linux!
Get Mandriva!
Get Joomla!
Hacker Emblem

Archives

Which topics would you like us to cover more?

Latest comments

Latest tweets

about 3 days ago Noscript and fritz.box #dib0 http://t.co/zxHEedNf9Q
about 10 days ago Social engineering from India #dib0 http://t.co/ajjp43WkVS
about 19 days ago @unwoman Got the kickstarter Uncovered Vol. 2 today! Thank you! I love it! http://t.co/x0Tzovtq8u
about 21 days ago A query is running #dib0 http://t.co/cRZ8Dd3nVp
15 Apr 2013 Locally save attachments from Oulook using VBScript #dib0 http://t.co/l6RhWQsvFL
1 Apr 2013 Publishing Outlook calendar for use in Google calendar through http://t.co/sfh5eNxGXM #dib0 http://t.co/IzWNPlaqNA
21 Mar 2013 http://t.co/j3B0kSLGkM Really interesting article. The church of pirates. Gods preferential option for the poor in the broadest sense.
14 Mar 2013 Happy Pi-day! And this is what's wrong with it... funny, but true. http://t.co/A8GIB8fugC
14 Mar 2013 Hey guys @piwik ! Just looking at my site stats. I love the new page overlay feature. Well done! :-)
3 Mar 2013 Really funny! The Burning Hearts Revolution: How Sesame Street is Undermining Biblical Values http://t.co/z8XFk5P4d3
26 Feb 2013 Recursively check and correct mp3 files in Linux #dib0 http://t.co/U3nzOuWzWM
26 Feb 2013 Haha! Met zo'n antwoord een terechte reactie! http://t.co/NYXIb27aP5 via @snippers
20 Feb 2013 Create random password with C#, Java and PHP #dib0 http://t.co/WgF7DtcT
Home
Joomla RSS Feed stats in Piwik
Written by Division by Zero   
Thursday, 26 May 2011 15:21

As you may know or have noticed I don't use Google Analytics. Instead I use an open source variant called Piwik.

I really love Piwik, but always had one wish: I want to see the visitors that read this blog through feeds. After some time of trying and searching I decided to write my own Joomla plugin that uses the Piwik Tracking API. Here are some code snippets to show you how it's done. If you want the plugin, download it here:

The Joomla plugin isn't very complicated. Without the standard plugin code, the actual Piwik Tracking code looks like this. I used the onAfterDispatch event to track this request with Piwik.

$mainframe = JFactory::getApplication();
// Only modify site pages that are not admin, install, etc.
if ( $mainframe->isSite() )
{
    // Only add stats for feed requests
    if ( $_REQUEST['format'] == 'feed' )
    {
        // Require the Piwik integration file
        require_once 'PiwikTracker.php';
        // Create tracker
        $piwikTracker = new PiwikTracker( $idSite = $this->params->get('siteid'), $apiUrl = $this->params->get('piwikuri'));
        $piwikTracker->setUrl( $url = $_SERVER['REQUEST_URI'] );
        // The auth token is required for overriding the server data with the original user data (such as IP-adress)
        $piwikTracker->setTokenAuth( $this->params->get('piwikauthtoken') );
        // Sends Tracker request via http
        $piwikTracker->doTrackPageView($this->params->get('pagetitle'));
    }
}
 

Add comment


Security code
Refresh

Computers are useless. They can only give you answers. - Pablo Picasso


© 2009 - 2013, Division by Zero

Template based on the empire template by joomlashack 

 Creative Commons License
This work by Division by Zero is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License.