Plugins You can find out about all the publicly available Grails plugins.

Piwik Plugin

  • Tags: web analytics
  • Latest: 0.1
  • Last Updated: 21 July 2013
  • Grails version: 2.0 > *
0 vote
compile "org.grails.plugins:piwik:0.1"

 Documentation  Source  Issues


A simple grails plugin to include piwik tracking code


grails install-plugin piwik-analytics


Piwik plugin

This plugin can be used to integrate Piwik ( open source web analytics in Grails application.

The plugin is written in Groovy/Grails without any dependencies on external libraries.

Current version

Current version is 0.1

Compatible with Piwik version 1.12

This version is developed and tested with Grails 2.1.1


Email: [email protected]


Add Piwik URL and Site ID to Configuration

Add your Piwik URL and Site ID to grails-app/config/Config.groovy: = "" = 1

Include Piwik Analytics tracking code to your page

Add the

<piwik:trackPageview />
tag to your view(s). If you want all your pages to include the tracking code, just add it to the main.gsp layout. As recommended by Piwik place this as last script in the <head> section.

        <piwik:trackPageview />

Sensible Defaults

The plugin uses sensible defaults. By default, when adding

<piwik:trackPageview />
to your views/layouts, only running in production will output the tracking code. Thus not in development and test.

This behaviour can be overridden by explicitly enabling/disabling Piwik Analytics in Config.groovy. = true

or = false

Tracking Customizations

If you want to customize the tracking code you can either provide the customization in grails-app/config/Config.groovy or in the tag itself. The customization can be a String of javascript code or a smart List with tracking code. The examples below speak for themselves.

Simple String configuration in Config.groovy = "_paq.push(['trackGoal', 1]); _paq.push(['enableLinkTracking']);"

Note that you have the trackPageview manually when using any custom tracking code.

List configuration in Config.groovy = [
    [trackGoal: 1],

Custom code directly in tag

<piwik:trackPageview customTrackingCode="_paq.push(['trackGoal', 1]); _paq.push(['enableLinkTracking']);" />

Note that you can also provide a similar List to the tag itself as in the other example.

Version History

  • 0.1
    • First official release