Matomo supports an opt out iframe, which may supports your needs. But in some cases it is more handy to realize opt out / opt in via ajax requests and with no iframes. May due to security reasons.

I had such a project and implemented this nice small plugin which offers you three new API URLs:

  1. your.piwik/index.php?module=API&method=AjaxOptOut.isTracked You will get an Response whether the current user get's tracked or not.
  2. your.piwik/index.php?module=API&method=AjaxOptOut.doIgnore Matomo will set the ignore cookie for the current user.
  3. your.piwik/index.php?module=API&method=AjaxOptOut.doTrack Matomo will remove the ignore cookie for the current user.

You have to use JSONP Requests, as of the AJAX requests needs to manipulate the cookies.

This plugin is for free, feel free to spend me a coffee and send me your feedback. Further information you can find in Matomo marketplace.

More Informatione here


View and download this plugin for a specific Matomo version:

Some years ago I worked as an senior web developer for some cool agency. We wanted to level up the typical german opt out from tracking game by some nice website overlay. Therefor we needed ajax endpoints in piwik / matomo to take control over the ignore cookie.

Respect open source community

After 2016 the development stuck. Plugin worked, no changes needed. But this is not how open source works.

When Matomo 4 came out, I feared to update my on-premise instance because this plugin maybe doesn't work. Stupid right?

So in 2021 I investigated a significant effort in test automation for my matomo plugins. Right now, the logic of this plugin is covered by integration tests which will run against all supported Matomo versions. In addition to run those tests against my code changes, I run them once a week against the newest developments so in case of problems, I get notified by CI/CD instead of you.

GitHub is a mirror

For the Matomo marketplace it is needed to have a GitHub project hosting the code.

Even if for this plugin there is a GitHub project, it is just a kind of mirror to my GitLab project. Changes are automatically pushed to GitHub, also releases will be automaticcally be created.

Feel free to fork my GitHub project. Even if I do not accept pull requests, I'm looking forward to take over your changes manually.

What's tested?

This plugin is tested by using GitLab CI.

PHP compatibility

I make sure all code changes are compatible to:

  • php 8.0
  • php 7.4
  • php 7.3
  • php 7.2
  • php 7.1
  • php 7.0
  • php 5.6

Integration with Matomo

I make sure that the plugin works as expected with this Matomo versions:

  • newest Matomo 3
  • newest Matomo 4

Does this plugin provide an UI?

No. This plugin just provides API endpoints.

Is this plugin under support?

Yes. Please review the support options in the marketplace.

Is there some alternative to jQuery?

Yes for sure. This Plugin is just an API which you can call from wherever you like. For example here you can find a web component to leverege this plugins API.

View and download this plugin for a specific Matomo version:


Please share