• Concrete5 and Piwik

    by  • Last modified:June 28, 2012 • Piwik, Plugin • 5 Comments

    Concrete 5 is one of the best CMS platforms to build a site. Lots of great things are built into Concrete5, including an area for Tracking Codes ( you can find it under System & Settings>SEO & Statistics>Tracking Codes).  Nevertheless, if you want to really to get the most from your Piwik install, you really should make changes to footer.php in your elements folder of your theme. This way you can take advantage of such things as custom variables from Piwik based on user behaviour (such as logged in users vs non logged in).

    To ensure you get download information of files in Piwik, unfortunately out of the box this doesn’t work without some modification. Piwik tracks download by filetype. Concrete5 urls do not have a filetype. Thankfully a great thing about Concrete5 is how it allows you to easily overide core functionality. To make this work, create a  copy of  \concrete5-install-path\concrete\blocks\file\view.php and place it in the root Concrete5 install  \concrete5-install-path\blocks\file\view.php as below:

    <?php   defined('C5_EXECUTE') or die("Access Denied.");
    	$f = $controller->getFileObject();
    	$fp = new Permissions($f);
    	if ($fp->canRead()) {
    		$c = Page::getCurrentPage();
    		if($c instanceof Page) {
    			$cID = $c->getCollectionID();
    		}
    ?>
    <!--<a href="<?php echo  View::url('/download_file', $controller->getFileID(),$cID) ?>"><?php echo  stripslashes($controller->getLinkText()) ?></a>-->
    <?php
    }
    $fo = $this->controller->getFileObject();?>
    <a href="<?php echo $fo->getRelativePath()?>"><?php echo  stripslashes($controller->getLinkText()) ?></a>
    

    Piwik Add-on for Concrete5

    Once you get the tracking set up for Piwik, you might want a quick way to get your Piwik Analytics in your Concrete5 install. Check out my Piwik Iframe by Stat Story add-on available free in the Concrete5 Marketplace. Below is a quick video showing you how to install and configure the add-on.

    If you have any questions, use the contact us on this website or leave a comment.

    About

    About The Author: Adrian has over 12 years experience in Digital Marketing and Analytics. He currently works as a Marketing Head of Community at Vanilla Forums, a modern forum software platform that allows clients to connect and engage their communities and customers. Adrian has extensive experience with Google and Piwik (Matomo) Analytics. He lives and works in Montreal.