Commits

Sylwester Gruszka committed 07e652d

by default don't track logged in staff

Comments (0)

Files changed (2)

cookiecontrol/templates/cookiecontrol/cookiecontrol.html

 });
 
 function ccAddAnalytics() {
-    {% if conf.ga_enabled %}
-    jQuery.getScript("http://www.google-analytics.com/ga.js", function() {
-        var GATracker = _gat._createTracker('{{ conf.ga_id }}');
-        GATracker._trackPageview();
-    });
-    {% endif %}
-    {% if conf.piwik_enabled %}
-    jQuery.getScript('{{ conf.piwik_base_url }}/piwik.js', function(){
-        var piwikTracker = Piwik.getTracker("{{ conf.piwik_base_url }}/piwik.php", "{{ conf.piwik_site_id }}");
-        piwikTracker.trackPageView();
-        piwikTracker.enableLinkTracking();
-    });
+    {% if not request.user.is_staff %}
+        {% if conf.ga_enabled %}
+        jQuery.getScript("http://www.google-analytics.com/ga.js", function() {
+            var GATracker = _gat._createTracker('{{ conf.ga_id }}');
+            GATracker._trackPageview();
+        });
+        {% endif %}
+        {% if conf.piwik_enabled %}
+        jQuery.getScript('{{ conf.piwik_base_url }}/piwik.js', function(){
+            var piwikTracker = Piwik.getTracker("{{ conf.piwik_base_url }}/piwik.php", "{{ conf.piwik_site_id }}");
+            piwikTracker.trackPageView();
+            piwikTracker.enableLinkTracking();
+        });
+        {% endif %}
     {% endif %}
 }
 

cookiecontrol/templatetags/cookiecontrol_tags.py

 
 register = Library()
 
+
 def cookiecontrol_js(context):
-    return Context({'conf': CookieControlConfig.objects.all()[0]})
+    request = context.get('request')
+    return Context({
+        'conf': CookieControlConfig.objects.all()[0],
+        'request': request,
+    })
 
 register.inclusion_tag("cookiecontrol/cookiecontrol.html", takes_context=True)(cookiecontrol_js)