aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/layouts/default.rhtml14
-rw-r--r--config/general.yml-example5
2 files changed, 18 insertions, 1 deletions
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index f439b27d2..5f6d5c721 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -154,6 +154,20 @@
<br />
<input type="text">
</div>
+ <%
+ ga_code = MySociety::Config.get('GA_CODE', '')
+ unless ga_code.empty?
+ %>
+ <script>
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+ <script>
+ var pageTracker = _gat._getTracker("<%=ga_code%>");
+ pageTracker._trackPageview();
+ </script>
+ <% end %>
+
</body>
</html>
diff --git a/config/general.yml-example b/config/general.yml-example
index ed04e0fd5..8b0281bfc 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -1,7 +1,7 @@
# general.yml-example:
# Example values for the "general" config file.
#
-# Configuration parameters, in YAML syntax.
+# Configuration parameters, in YAML syntax.
#
# Copy this file to one called "general.yml" in the same directory. Or
# have multiple config files and use a symlink to change between them.
@@ -142,3 +142,6 @@ EXCEPTION_NOTIFICATIONS_TO:
# This rate limiting can be turned off per-user via the admin interface
MAX_REQUESTS_PER_USER_PER_DAY: 6
+
+# Adding a value here will enable Google Analytics on all non-admin pages.
+GA_CODE: ''