Permalink
Browse files

Replace DISABLE_TRACKING and TRACKING_HTML by a TRACKING_ID variable …

…in configuration files
  • Loading branch information...
Simon Descarpentries
Simon Descarpentries committed May 6, 2014
1 parent 9e7563c commit 645d441236b152066cc89abb5e97f7c87d1b493d
Showing with 10 additions and 17 deletions.
  1. +2 −2 settings_local_sample.py
  2. +3 −2 src/cm/cm_settings.py
  3. +3 −3 src/cm/context_processors.py
  4. +0 −4 src/cm/settings.py
  5. +2 −6 src/cm/templates/site/tracking.html
View
@@ -79,6 +79,6 @@
# Set to False to use LibreOffice for convertion from and to legacy formats.
USE_ABI = True
-# Set to True if you don't want to appear in Sopinspace Piwik statistics
-DISABLE_TRACKING = DEBUG
+# Set to False to avoid appearing in Sopinspace Piwik statistics
+TRACKING_ID = False
View
@@ -13,6 +13,9 @@ def get_setting(setting_name, default=None):
DEFAULT_TIME_ZONE = get_setting('DEFAULT_TIME_ZONE','Europe/Paris')
+# Piwik tracking ID
+TRACKING_ID = get_setting ('TRACKING_ID', 17)
+
# button for new text version creation checked by default
NEW_TEXT_VERSION_ON_EDIT = get_setting('NEW_TEXT_VERSION_ON_EDIT', True)
@@ -25,8 +28,6 @@ def get_setting(setting_name, default=None):
# show email in user list
SHOW_EMAILS_IN_ADMIN = get_setting('SHOW_EMAILS_IN_ADMIN', True)
-TRACKING_HTML = get_setting('TRACKING_HTML', '')
-
# Store IP (or not) in activity
STORE_ACTIVITY_IP = get_setting('STORE_ACTIVITY_IP', True)
@@ -1,19 +1,19 @@
from django.conf import settings
+from cm.cm_settings import TRACKING_ID
from cm.models import ApplicationConfiguration
-from cm.cm_settings import TRACKING_HTML
from cm.converters.pandoc_converters import PANDOC_VERSION
+
def static(request):
"""
add static data to be used in templates
"""
return {
'SITE_URL' : settings.SITE_URL,
'CLIENT_DEBUG' : settings.CLIENT_DEBUG,
- 'DISABLE_TRACKING' : settings.DISABLE_TRACKING,
+ 'TRACKING_ID' : TRACKING_ID,
'YUI_VERSION' : settings.YUI_VERSION,
'CONF': ApplicationConfiguration,
'CM_MEDIA_PREFIX' : settings.CM_MEDIA_PREFIX,
- 'TRACKING_HTML' : TRACKING_HTML,
'PANDOC_VERSION' : PANDOC_VERSION,
}
View
@@ -2,10 +2,6 @@
CLIENT_DEBUG = DEBUG
TEMPLATE_DEBUG = DEBUG
-# Set to True if you don't want to appear in Sopinspace Piwik statistics
-DISABLE_TRACKING = DEBUG
-
-
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
@@ -1,8 +1,4 @@
-{% if DISABLE_TRACKING %}
-
-{% else %}
-
-{% autoescape off %}{{ TRACKING_HTML }}{% endautoescape %}
+{% if TRACKING_ID %}
<!-- Piwik -->
<script type="text/javascript">
@@ -27,7 +23,7 @@
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://stats.co-ment.com/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
- _paq.push(["setSiteId", "17"]);
+ _paq.push(["setSiteId", "{{ TRACKING_ID }}"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();

0 comments on commit 645d441

Please sign in to comment.