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

Add matomo cookie / tracking acceptance banner #464

Merged
merged 6 commits into from
Feb 7, 2025
Merged

Conversation

spwoodcock
Copy link
Member

@spwoodcock spwoodcock commented Feb 3, 2025

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Anticipates merge of #463
the only change here is actually to App.tsx.

Describe this PR

  • Adds matomo cookie tracking banner as requested.
  • Accepting will enable anonymised matomo tracking.
  • Rejecting will prevent any tracking.
  • Both will close the banner, with response saved to localStorage.

Note

I had to do a hacky workaround using style={{position: 'fixed', bottom: '0%'}} for fixed position on the screen.

This is due to hotosm/ui#72, so could be removed once fixed.

Screenshots

image

Checklist before requesting a review

  • πŸ“– Read the HOT Code of Conduct: https://docs.hotosm.org/code-of-conduct
  • πŸ‘·β€β™€οΈ Create small PRs. In most cases, this will be possible.
  • βœ… Provide tests for your changes.
  • πŸ“ Use descriptive commit messages.
  • πŸ“— Update any related documentation and include any relevant screenshots.

[optional] What gif best describes this PR or how it makes you feel?

@spwoodcock spwoodcock requested a review from emi420 February 3, 2025 22:51
@spwoodcock spwoodcock self-assigned this Feb 3, 2025
@github-actions github-actions bot added enhancement New feature or request frontend labels Feb 3, 2025
@spwoodcock spwoodcock changed the title Feat/matomo Add matomo cookie / tracking acceptance banner Feb 3, 2025
@emi420
Copy link

emi420 commented Feb 4, 2025

Do you think is necessary to have tracking with cookies? we could have visit metrics without cookies, which means that we wouldn't need the annoying "About the information we collect" acceptance banner.

This would do it:

<script>
  	var _paq = window._paq = window._paq || [];
  	/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
        _paq.push(['disableCookies']);
  	_paq.push(['trackPageView']);
  	(function() {
   	 var u="//matomo.hotosm.org/";
   	 _paq.push(['setTrackerUrl', u+'matomo.php']);
   	 _paq.push(['setSiteId', '35']);
   	 var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
   	 g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
	  })();
</script>
<!-- End Matomo Code -->

Copy link

@emi420 emi420 left a comment

Choose a reason for hiding this comment

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

I'm not sure about this PR, I would use the Matomo script for tracking without cookies.

What do you think?

@spwoodcock
Copy link
Member Author

Cookies are used for authentication.

They don't have any tracking, and are purely functional, but don't we need the banner for GDPR compliance?

@spwoodcock
Copy link
Member Author

Also as a side note, are you advocating for each project to insert its own matomo script, instead of standardising it in the web component?

I sense a reluctance to use the components, so just want to understand any reasoning πŸ˜ƒ

@emi420
Copy link

emi420 commented Feb 4, 2025

You don't need the banner for authentication, consent is needed for cookies that are not strictly necessary (ref: https://europa.eu/youreurope/business/dealing-with-customers/data-protection/online-privacy/index_en.htm).

I don't have an opinion on how the script should be inserted, we need it for obtaining metrics about usage of tools (ex: number of unique visitors) it could be trough a web component if you think that's the best approach.

All other HOT tools already have the script implemented.

@nrjadkry nrjadkry merged commit 9c093b6 into develop Feb 7, 2025
2 checks passed
@spwoodcock spwoodcock deleted the feat/matomo branch February 7, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants