Google Analytics Plugin

A plugin to insert the Google Analytics tracking code into Redmine based on user roles.


Adds your Google Analytics code to every pageview depending on your User roles; Anonymous user, Authenticated User, and Administrator.


0.1.0 version thumbnail

Installation and Setup

  1. Download the plugin. There are three supported ways:
    • Downloading the latest archive file from Little Stream Software projects
    • Checkout the source from Git
      git clone git:// vendor/plugins/google_analytics_plugin
    • Install it using Rail's plugin installer
      script/plugin install git://
  2. Login to your Redmine install as an Administrator.
  3. Configure your settings in Administration > Plugins > Configure


0.1.0 Release Announcement
0.2.0 Release Announcement

Hints and Tips

Tracking Logged In Users

You may add logged in user name using _setCustomVar call just before _trackPageview. Following Google Analytics code examples store user name in visitor-level slot #1 named 'Login'. They were tested on Redmine 0.9.3.

  • traditional code:
    pageTracker._setCustomVar(1, 'Login', document.getElementById('loggedas') != null
      ? document.getElementById('loggedas').childNodes[1].textContent : '(anonymous)', 1);
  • asynchronous code:
    _gaq.push(['_setCustomVar', 1, 'Login', document.getElementById('loggedas') != null
      ? document.getElementById('loggedas').childNodes[1].textContent : '(anonymous)', 1]);

Results will be available in "Visitors" -> "Custom Variables" -> "Login" report.

Tracking Redmine Search Queries

Follow appropriate Google Analytics Guide and use "q" (without quotes) as "Query Parameter". Results will be available in "Content" -> "Site Search" reports.

Updated by Artem Naluzhnyy over 14 years ago · 7 revisions