--- a/settings_local_sample.py Fri May 09 16:49:53 2014 +0200
+++ b/settings_local_sample.py Fri May 09 16:52:14 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 Fri May 09 16:49:53 2014 +0200
+++ b/src/cm/cm_settings.py Fri May 09 16:52:14 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 Fri May 09 16:49:53 2014 +0200
+++ b/src/cm/context_processors.py Fri May 09 16:52:14 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 Fri May 09 16:49:53 2014 +0200
+++ b/src/cm/settings.py Fri May 09 16:52:14 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/layout/header.html Fri May 09 16:49:53 2014 +0200
+++ b/src/cm/templates/site/layout/header.html Fri May 09 16:52:14 2014 +0200
@@ -4,9 +4,6 @@
<div id="header_controls">
-{% if not DISABLE_TRACKING %}
- <a id="hide-piwik-cookies-optout">{% blocktrans %}Privacy policy{% endblocktrans %} ▼ </a> ·
-{% endif %}
{% if user.is_authenticated %}<b>{{ user.username }}</b> ·{% endif %}
<a title="{% blocktrans %}Home{% endblocktrans %}" href="{% url index %}">{% blocktrans %}Home{% endblocktrans %}</a>
{% if can_create_text %}
@@ -16,6 +13,9 @@
{% endif %}
{% if user.is_authenticated %}
· <a title="{% blocktrans %}Profile{% endblocktrans %}" href="{% url profile %}">{% blocktrans %}Profile{% endblocktrans %}</a>
+{% if TRACKING_ID %}
+ · <a id="hide-piwik-cookies-optout">{% blocktrans %}Privacy policy{% endblocktrans %} </a>
+{% endif %}
· <a title="{% blocktrans %}Logout{% endblocktrans %}" href="{% url logout %}">{% blocktrans %}Logout{% endblocktrans %}</a>
{% else%}
· <a title="{% blocktrans %}Login{% endblocktrans %}" href="{% url login %}">{% blocktrans %}Login{% endblocktrans %}</a>
--- a/src/cm/templates/site/tracking.html Fri May 09 16:49:53 2014 +0200
+++ b/src/cm/templates/site/tracking.html Fri May 09 16:52:14 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);
})();
@@ -39,5 +35,5 @@
});
-->
</script>
-<div id="piwik-cookies-optout"><iframe frameborder="no" width="900px" height="90px" src="https://stats.co-ment.com/index.php?module=CustomOptOut&action=optOut&idSite=17&language={{ LANGUAGE_CODE }}"></iframe></div>
+<div id="piwik-cookies-optout"><iframe frameborder="no" width="900px" height="90px" src="https://stats.co-ment.com/index.php?module=CustomOptOut&action=optOut&idSite={{ TRACKING_ID }}&language={{ LANGUAGE_CODE }}"></iframe></div>
{% endif %}