incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#5149] Support tracking against multiple GA accounts.
Date Mon, 19 Nov 2012 14:50:23 GMT
Updated Branches:
  refs/heads/master aff89824d -> 1a519f233


[#5149] Support tracking against multiple GA accounts.

Signed-off-by: Kyle Adams <kyle@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1a519f23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1a519f23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1a519f23

Branch: refs/heads/master
Commit: 1a519f2338ef15802652200f0905ff76e6b56222
Parents: aff8982
Author: Kyle Adams <kyle@geek.net>
Authored: Thu Nov 15 20:37:07 2012 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Mon Nov 19 14:49:53 2012 +0000

----------------------------------------------------------------------
 Allura/allura/lib/app_globals.py                   |    4 +++-
 Allura/allura/lib/widgets/analytics.py             |    2 +-
 Allura/allura/templates/jinja_master/master.html   |    2 +-
 .../templates/jinja_master/theme_macros.html       |    9 ++++-----
 Allura/allura/templates/widgets/analytics.html     |    2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1a519f23/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 55ebf5d..1789855 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -95,7 +95,9 @@ class Globals(object):
         self.pypeline_markup = pypeline_markup
 
         # Setup analytics
-        self.analytics = analytics.GoogleAnalytics(account=config.get('ga.account', 'UA-XXXXX-X'))
+        accounts = config.get('ga.account', 'UA-XXXXX-X')
+        accounts = accounts.split(' ')
+        self.analytics = analytics.GoogleAnalytics(accounts=accounts)
 
         self.icons = dict(
             admin=Icon('x', 'ico-admin'),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1a519f23/Allura/allura/lib/widgets/analytics.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/analytics.py b/Allura/allura/lib/widgets/analytics.py
index 7880bba..e40054b 100644
--- a/Allura/allura/lib/widgets/analytics.py
+++ b/Allura/allura/lib/widgets/analytics.py
@@ -4,4 +4,4 @@ class GoogleAnalytics(ew.Widget):
     template='jinja:allura:templates/widgets/analytics.html'
     defaults=dict(
         ew.Widget.defaults,
-        account='UA-XXXXX-X')
+        accounts=['UA-XXXXX-X'])

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1a519f23/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index bb174ff..cc5fc01 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -49,7 +49,7 @@
 
     {% block head %}
     {% endblock %}
-{% if g.production_mode %}{{g.analytics.display()}}{% endif %}
+    {% if g.production_mode %}{{g.analytics.display()}}{% endif %}
   </head>
 
   <body{% block body_attrs %}{% endblock %} id="forge">

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1a519f23/Allura/allura/templates/jinja_master/theme_macros.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/theme_macros.html b/Allura/allura/templates/jinja_master/theme_macros.html
index 9b0b665..655b67b 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -27,7 +27,7 @@
 
 {%- endmacro %}
 
-{%- macro custom_tracking_js(account, user, project) %}
+{%- macro custom_tracking_js(accounts, user, project) %}
     {# This should be overridden in your custom theme (e.g., sftheme) to implement custom
tracking code. #}
     var _gaq = _gaq || [];
 
@@ -35,13 +35,12 @@
         _gaq.push(
             [prefix+'._setAccount', tracking_id],
             [prefix+'._trackPageview'],
-            [prefix+'._trackPageLoadTime']
         );
     }
 
-    {% if account -%}
-        _add_tracking('sfnt', '{{account}}');
-    {%- endif %}
+    {%- for account in accounts %}
+    _add_tracking('sfnt{{ loop.index }}', '{{account}}');
+    {%- endfor %}
     {% if project and project.neighborhood.features['google_analytics'] -%}
       {% if project.neighborhood.tracking_id -%}
           _add_tracking('nbhd', '{{project.neighborhood.tracking_id}}');

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1a519f23/Allura/allura/templates/widgets/analytics.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/analytics.html b/Allura/allura/templates/widgets/analytics.html
index d5b8737..681bf36 100644
--- a/Allura/allura/templates/widgets/analytics.html
+++ b/Allura/allura/templates/widgets/analytics.html
@@ -3,5 +3,5 @@
 {% endif %}
 
 <script type="text/javascript">
-    {{theme_macros.custom_tracking_js(account|default, c.user|default, c.project|default)}}
+    {{theme_macros.custom_tracking_js(accounts|default, c.user|default, c.project|default)}}
 </script>


Mime
View raw message