Replace DISABLE_TRACKING and TRACKING_HTML by a TRACKING_ID variable in configuration files
--- a/settings_local_sample.py Wed Apr 30 18:39:32 2014 +0200
+++ b/settings_local_sample.py Tue May 06 13:52:01 2014 +0200
@@ -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
--- a/src/cm/cm_settings.py Wed Apr 30 18:39:32 2014 +0200
+++ b/src/cm/cm_settings.py Tue May 06 13:52:01 2014 +0200
@@ -13,6 +13,9 @@
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 @@
# 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)
--- a/src/cm/context_processors.py Wed Apr 30 18:39:32 2014 +0200
+++ b/src/cm/context_processors.py Tue May 06 13:52:01 2014 +0200
@@ -1,7 +1,8 @@
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
@@ -9,11 +10,10 @@
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,
}
--- a/src/cm/settings.py Wed Apr 30 18:39:32 2014 +0200
+++ b/src/cm/settings.py Tue May 06 13:52:01 2014 +0200
@@ -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'),
)
--- a/src/cm/templates/site/tracking.html Wed Apr 30 18:39:32 2014 +0200
+++ b/src/cm/templates/site/tracking.html Tue May 06 13:52:01 2014 +0200
@@ -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);
})();