From f487cb895c1fd6d10c075d8203e2ad22d9f644d0 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Fri, 1 Jul 2022 00:57:51 +0200 Subject: [PATCH] Fix Matomo noscript tag Reference: https://matomo.org/faq/how-to/faq_176/ --- analytical/templatetags/matomo.py | 2 +- tests/unit/test_tag_matomo.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/analytical/templatetags/matomo.py b/analytical/templatetags/matomo.py index 15334fb..c5b1c1c 100644 --- a/analytical/templatetags/matomo.py +++ b/analytical/templatetags/matomo.py @@ -37,7 +37,7 @@ TRACKING_CODE = """ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); - + """ # noqa VARIABLE_CODE = '_paq.push(["setCustomVariable", %(index)s, "%(name)s", "%(value)s", "%(scope)s"]);' # noqa diff --git a/tests/unit/test_tag_matomo.py b/tests/unit/test_tag_matomo.py index f842d29..6e9a850 100644 --- a/tests/unit/test_tag_matomo.py +++ b/tests/unit/test_tag_matomo.py @@ -23,13 +23,13 @@ class MatomoTagTestCase(TagTestCase): r = self.render_tag('matomo', 'matomo') assert '"//example.com/"' in r assert "_paq.push(['setSiteId', 345]);" in r - assert 'img src="//example.com/piwik.php?idsite=345"' in r + assert 'img src="//example.com/matomo.php?idsite=345"' in r def test_node(self): r = MatomoNode().render(Context({})) assert '"//example.com/";' in r assert "_paq.push(['setSiteId', 345]);" in r - assert 'img src="//example.com/piwik.php?idsite=345"' in r + assert 'img src="//example.com/matomo.php?idsite=345"' in r @override_settings(MATOMO_DOMAIN_PATH='example.com/matomo', MATOMO_SITE_ID='345')