Matomo: Opt Out without an Iframe

Created on 1 Feb 2012  路  8Comments  路  Source: matomo-org/matomo

http://demo.piwik.org/index.php?module=CoreAdminHome&action=optOut
Hi,
I hate Iframes, because they can't adapt to the screen size of the user. Is there another possibillity to inform the user about his state and peform an Opt Out/In without an iframe?

This would be great =)

Enhancement duplicate

Most helpful comment

For all: I wrote an Plugin for opting out via AJAX. On public interest, I will push it to github.

All 8 comments

1929

@mattab @robocoder Please can you give an nice short Statement about why "without an iFrame" is an dupplicate to "custom CSS"?

I don't get it.

I Need an opt out without an iFrame. Thought that is no Problem. Everything is ready, now just the JS AJAX to let piwik know, the user opted out is missing. And now I see: Seems that there is no solution.

PIWIK Team ignores all requests for throwing away that iFrame with info "dupplicate to custom css ticket". That's not what I would do, custom style opt out. I would like to have an custom opt out.

That starts with TEXT. That starts with CSS. That starts with UX. There are multiple reasons to don't load iFrame here.

So please: Do I really have to code my own Plugin to Support AJAX requests for opt out?
An short Statement, why you block requests for "Ajax opt out" would be nice to understand why you do so.

For all: I wrote an Plugin for opting out via AJAX. On public interest, I will push it to github.

Hi @lippoliv - we can always consider adding such feature into core and provide a new API, but it would be even better for you to release your plugin on the Marketplace, so :+1: for this idea!

@lippoliv would you please share your code?
I'd love to integrate it to my website because I built it to a 100% responsive and adding a non responsive iframe is the last thing I wanna do...

@Piwik: Please add this feature in your next update, you really should know, that iframes are not state of the art...

@mattab OK as we spoke per Mail I will add to marketplace.

@chwebo Find the Plugin here AjaxOptOut.zip
Just unzip and upload the Folder to PIWIKINSTALL/plugins-Folder.

There are three AJAX-URLs:

  1. index.php?module=API&method=AjaxOptOut.isTracked&format=json, wich Returns if you are tracked or not
  2. index.php?module=API&method=AjaxOptOut.doIgnore&format=json, wich will set the PIWIK Ignore Cookie
  3. index.php?module=API&method=AjaxOptOut.doTrack&format=json, wich will remove the PIWIK Ignore Cookie

IMPORTANT: As of this technique is using Cookies, you have to use JSONP-Requests, instead of just JSON.

Let me know if it works and write me anything wich will not work (you find an Mail-Adress in plugin.json file). I will publish the Plugin ASAP if it works for you too :)

Hi everybody.
Sorry for commenting on this issue, but I wanted to give feedback to the plugin by @lippoliv. (Maybe it would be useful to start a new issue or publish a new "project"?)
Actually, it's not even a real feedback, since it doesn't yet work for me ;)
After uploading the plugin folder to the plugins directory of the Piwik-installation, doesn't the plugin need to be registered in the kernel/core?
For me, visiting the provided paths triggers a standard error-json-response:

The plugin AjaxOptOut is not enabled.

I've looked in the settings > plugins section but there's no entry for that precise plugin. Maybe it's cache related, maybe it needs registration in the core, I can't tell since I'm not aware how Piwik precisely works...
Thanks for any response ;)

Regards.


EDIT:
Sorry, I completely forgot to activate the plugin on the Plugins page...
Everything seems to work. Thank you @lippoliv for your contribution!


EDIT2:
I wanted to add that after installing the plugin and writing an AJAX/JSONP script to communicate with the remote analytics server, it may be necessary to configure the server to accept the API-Call with:
Header set Access-Control-Allow-Origin * in the .htaccess-file or php.ini. ;)

Hey @lippoliv @Lozik,
I think I need help with this. ;(
I can't get the AJAX/JASONP script to work as I want. The only way the plugin works for me if I use the AJAX-URLs directly on my page. But this leads to a new window with the json response and the other window still displaying the old tracking status.
When I tried to use links triggering an ajax/jsonp request using the enable or disable urls I only got a strange callback response from the url of the page I was on when clicking the link.
@Lozik: Could you maybe post your script or help me in any other way? I'm getting kind of depressed here...

Arno

EDIT:
Just after posting this I found the error in my own AJAX/JASONP script:
I had the link url for the activate/deactivate link dynamically inserted based on the current tracking status. The value returned from the status check was either true or false, but in my if clause I asked for a boolean value when in fact the status check returns a string...
So, in a way posting here helped after all. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jurvi picture jurvi  路  3Comments

jangrewe picture jangrewe  路  4Comments

alexandrestein picture alexandrestein  路  4Comments

kofi1995 picture kofi1995  路  5Comments

tassoman picture tassoman  路  4Comments