From 7e3f9d1de8431f50d2e38d722745b5acb636dfba Mon Sep 17 00:00:00 2001 From: Julian Haluska Date: Sat, 12 Jan 2019 11:41:07 +0100 Subject: [PATCH] Removed backslashes from strings, improved documentation text --- analytical/templatetags/piwik.py | 4 ++-- analytical/tests/test_tag_piwik.py | 2 +- docs/services/piwik.rst | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/analytical/templatetags/piwik.py b/analytical/templatetags/piwik.py index 10819a3..d863eef 100644 --- a/analytical/templatetags/piwik.py +++ b/analytical/templatetags/piwik.py @@ -41,8 +41,8 @@ TRACKING_CODE = """ VARIABLE_CODE = '_paq.push(["setCustomVariable", %(index)s, "%(name)s", "%(value)s", "%(scope)s"]);' # noqa IDENTITY_CODE = '_paq.push(["setUserId", "%(userid)s"]);' -DISABLE_COOKIES_CODE = '_paq.push([\'disableCookies\']);' -ASK_FOR_CONSENT_CODE = '_paq.push([\'requireConsent\']);' +DISABLE_COOKIES_CODE = "_paq.push(['disableCookies']);" +ASK_FOR_CONSENT_CODE = "_paq.push(['requireConsent']);" FORGET_CONSENT_CODE = 'document.getElementById("piwik_deny_consent").addEventListener("click", () => { _paq.push(["forgetConsentGiven"]); });' REMEMBER_CONSENT_CODE = 'document.getElementById("piwik_give_consent").addEventListener("click", () => { _paq.push(["setConsentGiven"]); _paq.push(["rememberConsentGiven"]); });' diff --git a/analytical/tests/test_tag_piwik.py b/analytical/tests/test_tag_piwik.py index b760374..0149eb4 100644 --- a/analytical/tests/test_tag_piwik.py +++ b/analytical/tests/test_tag_piwik.py @@ -154,4 +154,4 @@ class PiwikTagTestCase(TagTestCase): @override_settings(PIWIK_ASK_FOR_CONSENT=True) def test_ask_for_consent(self): r = PiwikNode().render(Context({})) - self.assertTrue("_paq.push([\'requireConsent\']);" in r, r) + self.assertTrue("_paq.push(['requireConsent']);" in r, r) diff --git a/docs/services/piwik.rst b/docs/services/piwik.rst index d012aca..869e1f6 100644 --- a/docs/services/piwik.rst +++ b/docs/services/piwik.rst @@ -146,7 +146,7 @@ Disabling cookies ----------------- If you want to `disable cookies`_, set :data:`PIWIK_DISABLE_COOKIES` to -:const:`True`. This is disabled by default. +:const:`True`. By default, cookies are enabled (i.e. :const:False). .. _`disable cookies`: https://matomo.org/faq/general/faq_157/ @@ -154,12 +154,12 @@ Ask for consent ----------------- If you want to ask for consent set :data:`PIWIK_ASK_FOR_CONSENT` to -:const:`True`. This is disabled by default. +:const:`True`. By default, no consent by the visitor is needed (i.e. :const:False). -To ask the visitor for consent just create DOM elements with the following id's: +To ask the visitor for consent in your page, create DOM elements with the following id's: -`piwik_deny_consent` - id for DOM element to click, if the user denies consent -`piwik_give_consent` - id for DOM element to click, if the user gives consent +`piwik_deny_consent` - id for element to click when the user denies consent +`piwik_give_consent` - id for element to click when the user gives consent .. _`asking for consent`: https://developer.matomo.org/guides/tracking-javascript-guide#asking-for-consent