Luke Plant avatar Luke Plant committed b4e7897

Made Google analytics only appear when in production

Comments (0)

Files changed (4)

cciw/cciwmain/common.py

             l.isCurrentSection = True
 
     context['menulinks'] = links
+    context['GOOGLE_ANALYTICS_ACCOUNT'] = getattr(settings, 'GOOGLE_ANALYTICS_ACCOUNT', '')
 
     return context
 
 LIVEBOX = not DEVBOX
 
 if LIVEBOX:
-    from cciw.settings_priv import PRODUCTION, STAGING
+    from cciw.settings_priv import PRODUCTION, STAGING, GOOGLE_ANALYTICS_ACCOUNT
 
 WEBSERVER_RUNNING = 'mod_wsgi' in sys.argv
 

templates/admin/base_site.html

    $(document).ready(cciw.externalLinks);
 })(jQuery);
 </script>
+{% if GOOGLE_ANALYTICS_ACCOUNT %}
 <script type="text/javascript">
 
   var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-23715914-1']);
+  _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS_ACCOUNT }}']);
   _gaq.push(['_trackPageview']);
 
   (function() {
   })();
 
 </script>
+{% endif %}
 {% endblock %}
 {% block branding %}
 <div id="header2">

templates/cciw/base.html

 <link href="https://fonts.googleapis.com/css?family=Amaranth" rel="stylesheet" type="text/css" />
 <link rel="stylesheet" href="{{ STATIC_URL }}css/style.css" type="text/css" />
 {% block extraheader %}{% endblock %}
+{% if GOOGLE_ANALYTICS_ACCOUNT %}
 <script type="text/javascript">
 
   var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-23715914-1']);
+  _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS_ACCOUNT }}']);
   _gaq.push(['_trackPageview']);
 
   (function() {
   })();
 
 </script>
+{% endif %}
 </head>
 <body>
 {% block bodystart %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.