Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask for consent - Matomo (Piwik) #142

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jayhaluska
Copy link

@jayhaluska jayhaluska commented Jan 11, 2019

This is a pull request to add the "Ask for consent" functionality from Matomo (Piwik). Especially relevant in the context of the new GDPR in Europe.

See: https://developer.matomo.org/guides/tracking-javascript-guide#asking-for-consent

@jayhaluska jayhaluska changed the title Asking for consent implementation + documentation Ask for consent - Matomo (Piwik) Jan 11, 2019
@bittner
Copy link
Member

bittner commented Jan 11, 2019

Fixes #141

Copy link
Member

@bittner bittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes sound good in general. If we could make it more elegant (e.g. just a single JavaScript call to pull the feature in from Matomo) that would be even more awesome! Do you see a way?

docs/services/piwik.rst Show resolved Hide resolved
analytical/templatetags/piwik.py Outdated Show resolved Hide resolved
analytical/tests/test_tag_piwik.py Outdated Show resolved Hide resolved
docs/services/piwik.rst Outdated Show resolved Hide resolved
docs/services/piwik.rst Outdated Show resolved Hide resolved
analytical/templatetags/piwik.py Outdated Show resolved Hide resolved
analytical/templatetags/piwik.py Outdated Show resolved Hide resolved
analytical/templatetags/piwik.py Outdated Show resolved Hide resolved
docs/services/piwik.rst Outdated Show resolved Hide resolved
Copy link
Collaborator

@jcassee jcassee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for the work, Julian! @bittner?

@jayhaluska
Copy link
Author

jayhaluska commented Jun 3, 2019

Merged the newest version of django-analytical into my fork.

I think this PR was forgotten, can we get it merged, @bittner?

@bittner
Copy link
Member

bittner commented Jun 3, 2019

Probably it makes more sense now to add these changes to the newly created Matomo tag.

@jayhaluska
Copy link
Author

I added the 'ask for consent' logic and documentation to the new matomo files and renamed everything accordingly.

But now the Travis CI check fails and I don't know why. Any suggestions?

@bittner
Copy link
Member

bittner commented Jun 12, 2019

But now the Travis CI check fails and I don't know why. Any suggestions?

Flake8 complains about a missing newline in the test file:

./analytical/tests/test_tag_matomo.py:157:66: W292 no newline at end of file

It's a good idea to configure your IDE in a way that it ensures a final newline in every file you touch. Most modern IDEs have such a setting now.

Copy link
Member

@bittner bittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we have discussed this before. (Sorry, if we have!)

@@ -98,6 +122,9 @@ def render(self, context):
if getattr(settings, 'PIWIK_DISABLE_COOKIES', False):
commands.append(DISABLE_COOKIES_CODE)

if getattr(settings, 'PIWIK_ASK_FOR_CONSENT', False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still says, PIWIK in the constant name. Shouldn't it say MATOMO?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this code shouldn't go here at all. As mentioned by my other comments.

<button class="piwik_remove_consent">Don't track me anymore!</button>

.. _`asking for consent`: https://developer.matomo.org/guides/tracking-javascript-guide#asking-for-consent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we remove the documentation for Piwiki all together, maybe just showing a hint on the new location and the reason for it? I don't think it makes sense to continue to maintain, let alone extend, it.

@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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the missing newline that causes Flake8 to fail.

}}
);
}}
""".format(REMOVE_CONSENT_CLASS, GIVE_CONSENT_CLASS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really just keep the Piwik implementation as is. Not extend it.

I'm not even sure if it would work. There is no Piwik that does consent. It's only Matomo that does it.

@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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: Why add code and tests for an obsolete integration?

@bittner
Copy link
Member

bittner commented Jul 11, 2021

This PR needs to be rebased and its conflicts resolved. In addition, some review comments may still need to be addressed. But then it would be ready to be merged.

Want to give it another try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants