PluginGoogleAnalytics

Version 7 (Artem Naluzhnyy, 2010-04-20 19:35)

1 1 Eric Davis
h1. Google Analytics Plugin
2 1 Eric Davis
3 1 Eric Davis
A plugin to insert the Google Analytics tracking code into Redmine based on user roles.
4 1 Eric Davis
5 1 Eric Davis
h2. Features
6 1 Eric Davis
7 1 Eric Davis
Adds your Google Analytics code to every pageview depending on your User roles; Anonymous user, Authenticated User, and Administrator.
8 1 Eric Davis
9 1 Eric Davis
h2. Screenshot:
10 1 Eric Davis
11 2 Eric Davis
!google_analytics_plugin_thumb.png!:/attachments/995/google_analytics_plugin.png
12 1 Eric Davis
13 1 Eric Davis
h2. Installation and Setup
14 1 Eric Davis
15 1 Eric Davis
16 1 Eric Davis
# Download the plugin.  There are three supported ways:
17 3 Eric Davis
#* Downloading the latest archive file from "Little Stream Software projects":https://projects.littlestreamsoftware.com/projects/list_files/redmine-analytics
18 1 Eric Davis
#* Checkout the source from Git
19 1 Eric Davis
       @git clone git://github.com/edavis10/redmine-google-analytics-plugin.git vendor/plugins/google_analytics_plugin@
20 1 Eric Davis
#* Install it using Rail's plugin installer
21 1 Eric Davis
       @script/plugin install git://github.com/edavis10/redmine-google-analytics-plugin.git@
22 1 Eric Davis
# Login to your Redmine install as an Administrator.
23 5 Jean-Philippe Lang
# Configure your settings in Administration > Plugins > Configure
24 1 Eric Davis
25 1 Eric Davis
26 1 Eric Davis
h2. News
27 4 Eric Davis
28 4 Eric Davis
"0.1.0 Release Announcement":http://theadmin.org/articles/2008/10/1/redmine-google-analytics-plugin
29 6 Eric Davis
"0.2.0 Release Announcement":https://projects.littlestreamsoftware.com/news/49
30 7 Artem Naluzhnyy
31 7 Artem Naluzhnyy
h2. Hints and Tips
32 7 Artem Naluzhnyy
33 7 Artem Naluzhnyy
h3. Tracking Logged In Users
34 7 Artem Naluzhnyy
35 7 Artem Naluzhnyy
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.
36 7 Artem Naluzhnyy
37 7 Artem Naluzhnyy
* "traditional code":http://code.google.com/apis/analytics/docs/tracking/gaTrackingOverview.html#standardSetup:<pre>
38 7 Artem Naluzhnyy
...
39 7 Artem Naluzhnyy
pageTracker._setCustomVar(1, 'Login', document.getElementById('loggedas') != null
40 7 Artem Naluzhnyy
  ? document.getElementById('loggedas').childNodes[1].textContent : '(anonymous)', 1);
41 7 Artem Naluzhnyy
pageTracker._trackPageview();
42 7 Artem Naluzhnyy
...
43 7 Artem Naluzhnyy
</pre>
44 7 Artem Naluzhnyy
45 7 Artem Naluzhnyy
* "asynchronous code":http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html: <pre>
46 7 Artem Naluzhnyy
...
47 7 Artem Naluzhnyy
_gaq.push(['_setCustomVar', 1, 'Login', document.getElementById('loggedas') != null
48 7 Artem Naluzhnyy
  ? document.getElementById('loggedas').childNodes[1].textContent : '(anonymous)', 1]);
49 7 Artem Naluzhnyy
_gaq.push(['_trackPageview']);
50 7 Artem Naluzhnyy
...
51 7 Artem Naluzhnyy
</pre>
52 7 Artem Naluzhnyy
53 7 Artem Naluzhnyy
Results will be available in "Visitors" -> "Custom Variables" -> "Login" report.
54 7 Artem Naluzhnyy
55 7 Artem Naluzhnyy
h3. Tracking Redmine Search Queries
56 7 Artem Naluzhnyy
57 7 Artem Naluzhnyy
Follow appropriate "Google Analytics Guide":http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=75817 and use "q" (without quotes) as "Query Parameter". Results will be available in "Content" -> "Site Search" reports.