Skip to content

Supports Opt Out from piwik/matomo tracking through Ajax-Request.

Notifications You must be signed in to change notification settings

lippoliv/piwik-plugin-ajaxoptout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AjaxOptOut Plugin

Description

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

Demo

There is a Demo available for you to mention how to use it in your Project.

jQuery

  1. Set the correct Matomo Url in demo/jquery/index.html (update the Row var piwikUrl = 'http://piwik.lc/';).
  2. Open the index.html via an running WebServer in your favorit Browser
  3. Use the Buttons to toggle the tracking state
  4. In parallel, watch the Tracking-Status in Matomo Backend or the Matomo Tracking iFrame

ToDo-List

  1. Implement jQuery Module
  2. Share jQuery Module via npm
  3. Implement AngularJS Module
  4. Share AngularJS Module via npm
  5. Implement Angular Module
  6. Share Angular Module via npm
  7. Implement TypeScript Definition
  8. Share TypeScript Definition via @types-Repository