diff --git a/analytical/templatetags/matomo.py b/analytical/templatetags/matomo.py index 9107516..4ff6c2e 100644 --- a/analytical/templatetags/matomo.py +++ b/analytical/templatetags/matomo.py @@ -46,8 +46,8 @@ VARIABLE_CODE = ( IDENTITY_CODE = '_paq.push(["setUserId", "%(userid)s"]);' DISABLE_COOKIES_CODE = "_paq.push(['disableCookies']);" -GIVE_CONSENT_CLASS = "matomo_give_consent" -REMOVE_CONSENT_CLASS = "matomo_remove_consent" +GIVE_CONSENT_CLASS = 'matomo_give_consent' +REMOVE_CONSENT_CLASS = 'matomo_remove_consent' ASK_FOR_CONSENT_CODE = """ _paq.push(['requireConsent']); diff --git a/tests/unit/test_tag_matomo.py b/tests/unit/test_tag_matomo.py index 0765c12..c6ebd93 100644 --- a/tests/unit/test_tag_matomo.py +++ b/tests/unit/test_tag_matomo.py @@ -159,3 +159,8 @@ class MatomoTagTestCase(TagTestCase): def test_disable_cookies(self): r = MatomoNode().render(Context({})) assert "_paq.push(['disableCookies']);" in r + + @override_settings(MATOMO_ASK_FOR_CONSENT=True) + def test_ask_for_consent(self): + r = MatomoNode().render(Context({})) + self.assertTrue("_paq.push(['requireConsent']);" in r, r)