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

Adblock #3

Closed
viktor-zhuromskyy opened this issue Oct 19, 2016 · 14 comments
Closed

Adblock #3

viktor-zhuromskyy opened this issue Oct 19, 2016 · 14 comments

Comments

@viktor-zhuromskyy
Copy link

Adblock and similar extensions block whatever has "piwik" either in reference URL or in context present.

Would you consider refactoring your extension in order to hide the Piwik mentions in generated JS and HTML code in order to avoid such Browser extensions blocking the tracking info?

Also, would be nice to have the ability to select in admin a custom tracking .JS file, but not to have piwik.php and piwik.js hardcoded!!!

Thanks!

@henkelund
Copy link
Collaborator

Hi,

I agree it's a good idea to not hard code piwik.php and piwik.js. I've made a new branch where ju can change their paths in the stores configuration. You can try it out with composer require henhed/module-piwik:1.2.0.x-dev. If it works for you, please let me know and I'll tag a new release.

I'm not familiar with how Adblock works but it seems like it would be really difficult to change the URL of the modules JS-file without also changing the name of the module, which would probably cause more problems than it solves.

You could try to make a small module with a view/frontend/requirejs-config.js file to map the require name to something else:

var config = {
    map: {
        '*': {
            'Henhed_Piwik/js/tracker': 'DefinitelyNotTrackingYou'
        }
    }
};

And then use an nginx rewrite (or Apache RewriteRule/Cond) to reference the original script.

location ~* /DefinitelyNotTrackingYou\.js$ {
  rewrite ^(.*)/DefinitelyNotTrackingYou\.js$ $1/Henhed_Piwik/js/tracker.js;
}

I'm not sure what's ment by "context" but it might be worth a try.

Cheers,
H

@viktor-zhuromskyy
Copy link
Author

Thank you for the update. I will replace 'dev-master' with your new 1.2.0.x-dev and will play with it.
I already changed a few things via Nginx rewrites, and folder name for my Piwik install.

Will keep you updated. My site is https://endohaus.com

@viktor-zhuromskyy
Copy link
Author

viktor-zhuromskyy commented Oct 27, 2016

I tested your 1.2.0.x-dev branch, and it does what I asked for, but if you have time to add additional field in admin for serving piwik.js script from a different domain (CDN, in my case). It will speed up total page loading time.

In my dedicated servers structure, I managed to load any page on M2 within 3.6 seconds with all static content. That's a record!

Currently, piwik.js loads from another domain, so extra DNS lookup, new TLS handshake, etc is needed. So, the piwik.js loads within 650-1600 ms, but I want it to be delivered via already used CDN along with other content, and cookieless.

Right now that's what I have... And with extra modification will cut loading time of a complete website page under mere 3 seconds! And, forgot to mention, everything is served via SSL/TLS.

Settings page:
image 2016-10-27 11 31 34

Adblock ON:
We will have to rewrite Henhed_Piwik/js/tracker
image 2016-10-27 11 41 52

Adblock OFF:
image 2016-10-27 11 45 13

GT Metrics test results:
image 2016-10-27 11 49 22
image 2016-10-27 11 49 39

@viktor-zhuromskyy
Copy link
Author

I just did HTML Substitution via NGINX, and piwik.js loading results via CDN are impressive.

image 2016-10-27 12 09 26
image 2016-10-27 12 09 46

@henkelund
Copy link
Collaborator

I'm glad to hear you've made progress. Good call with the nginx substitution, though it's a bit of a hack of course.

I've pushed a couple of new updates (to the same branch) where there's a new setting called CDN Hostname in the config section. This only affects the URL of the javascript, not the PHP script. If it's empty it will fall back on the regular hostname so it shouldn't break any existing installtions.

Feel free to try it out and let me know if it does the trick for you.

@viktor-zhuromskyy
Copy link
Author

Nice. Thank you.
I am doing Redis DB failover setup right now across 6 servers, so do not have time right now, but in a day or two will come back with test results and suggestions.

Thanks a lot!!!

@viktor-zhuromskyy
Copy link
Author

CDN hostname feature tested well. Nice job!

So far, to cheat AdBlock extensions we can:

  1. choose custom domain, sub-domain or sub-folder in one of these,
  2. change request file names from piwik.php and piwik.js into iha.php and iha.js accordingly, in my case, if we have Piwik / Nginx/Apache set up to serve file name aliases.
  3. serve tracking JS file via CDN network.

But the efforts are senseless if we do not adjust the code to achieve the following:

  1. replace all mentions of piwik and tracker in Henhed_Piwik/js/tracker.js
  2. change request for Henhed_Piwik/js/tracker into something like Henhed_Iha/js/loader along with the Henhed_Piwik/js/tracker.js file name in static content folder into Henhed_Iha/js/loader.js

@henkelund
Copy link
Collaborator

Hi again,

I don't agree that the changes are senseless, having these things configurable is still a good thing.

Unfortunately, I don't think replacing all mentions of "piwik" and "tracker" in tracker.js is a good idea because

  1. Piwik exports the global symbols Piwik and piwikAsyncInit. These are used by tracker.js and removing/renaming them will break functionality.
  2. tracker.js exposes the functions createTracker, getPiwik and getTracker as part of its public API, renaming them will break backward compatibility.
  3. Even if we would eliminate all those mentions we still have to include piwik.js (iha.js in your case) which itself has lots of mentions of both "piwik" and "tracker". So why wouldn't Adblock ban that script as well?

Unless I'm horribly misunderstanding you I'm afraid this idea is a wontfix.

But, I have a suggestion you might try if you find it appealing.

Add these two files to your theme to overwrite tracker.js:

Devdesco
└── endohaus
    ├── requirejs-config.js
    └── web
        └── js
            └── iha.js

This directive will map the component name to a new URL, /static/frontend/Devdesco/endohaus/en_US/js/iha.js, which gets rid of both "Piwik" and "tracker" from the original URL.

/* Devdesco/endohaus/requirejs-config.js */
var config = {
   map: {
       '*': {
           'Henhed_Piwik/js/tracker': 'js/iha'
       }
   }
};

Run the original tracker.js code through javascript-obfuscator and put it in iha.js. This should get rid of all literal mentions of "piwik" and "tracker" but still evaluate to the same as the original script.

/* Devdesco/endohaus/web/js/iha.js */
var _0x2b62=['\x74\x72\x61\x63\x6b\x65\x72\x55\x72\x6c','\x73\x63\x72\x69\x70\x74\x55\x72\x6c','\x5f\x70\x61\x71','\x73\x75\x62\x73\x63\x72\x69\x62\x65','\x6a\x71\x75\x65\x72\x79','\x75\x6e\x64\x65\x72\x73\x63\x6f\x72\x65','\x4d\x61\x67\x65\x6e\x74\x6f\x5f\x43\x75\x73\x74\x6f\x6d\x65\x72\x2f\x6a\x73\x2f\x63\x75\x73\x74\x6f\x6d\x65\x72\x2d\x64\x61\x74\x61','\x6a\x71\x75\x65\x72\x79\x2f\x6a\x71\x75\x65\x72\x79\x2d\x73\x74\x6f\x72\x61\x67\x65\x61\x70\x69','\x70\x69\x77\x69\x6b\x41\x73\x79\x6e\x63\x49\x6e\x69\x74','\x69\x6e\x69\x74\x4e\x61\x6d\x65\x73\x70\x61\x63\x65\x53\x74\x6f\x72\x61\x67\x65','\x61\x70\x70\x65\x6e\x64\x54\x6f','\x61\x74\x74\x72','\x3c\x73\x63\x72\x69\x70\x74\x3e','\x74\x79\x70\x65','\x64\x65\x66\x65\x72','\x73\x72\x63','\x68\x65\x61\x64','\x65\x61\x63\x68','\x72\x65\x73\x6f\x6c\x76\x65','\x69\x73\x4f\x62\x6a\x65\x63\x74','\x50\x69\x77\x69\x6b','\x44\x65\x66\x65\x72\x72\x65\x64','\x72\x65\x6a\x65\x63\x74','\x70\x72\x6f\x6d\x69\x73\x65','\x64\x6f\x6e\x65','\x67\x65\x74\x41\x73\x79\x6e\x63\x54\x72\x61\x63\x6b\x65\x72','\x67\x65\x74\x54\x72\x61\x63\x6b\x65\x72','\x69\x73\x41\x72\x72\x61\x79','\x66\x69\x72\x73\x74','\x73\x68\x69\x66\x74','\x69\x73\x46\x75\x6e\x63\x74\x69\x6f\x6e','\x61\x70\x70\x6c\x79','\x70\x75\x73\x68','\x68\x61\x73','\x64\x61\x74\x61\x5f\x69\x64','\x63\x61\x72\x74\x2d\x64\x61\x74\x61\x2d\x69\x64','\x70\x69\x77\x69\x6b\x41\x63\x74\x69\x6f\x6e\x73','\x73\x65\x74\x53\x69\x74\x65\x49\x64','\x73\x69\x74\x65\x49\x64'];(function(_0x3b538a,_0x51052a){var _0x2f350e=function(_0x1b264c){while(--_0x1b264c){_0x3b538a['\x70\x75\x73\x68'](_0x3b538a['\x73\x68\x69\x66\x74']());}};(function(){var _0x5639f1=function(){return'\x64\x65\x76';};!Function('\x72\x65\x74\x75\x72\x6e\x2f\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d\x2f')()['\x74\x65\x73\x74'](_0x5639f1['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x74\x72\x75\x65\x29\x7b\x7d')():Function('\x61','\x62','\x61\x28\x2b\x2b\x62\x29')(_0x2f350e,_0x51052a)?[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x66\x61\x6c\x73\x65\x29\x7b\x7d')():[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x66\x61\x6c\x73\x65\x29\x7b\x7d')();}());}(_0x2b62,0x1b1));var _0x388b=function(_0xadcd00){return _0x2b62[parseInt(_0xadcd00,0x010)];};(function(){var _0x45525c=function(){return'\x64\x65\x76';},_0x4693c1=function(){return'\x77\x69\x6e\x64\x6f\x77';};!Function('\x72\x65\x74\x75\x72\x6e\x2f\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d\x2f')()['\x74\x65\x73\x74'](_0x45525c['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?Function('\x72\x65\x74\x75\x72\x6e\x2f\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b\x2f')()['\x74\x65\x73\x74'](_0x4693c1['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x66\x61\x6c\x73\x65\x29\x7b\x7d')():[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x74\x72\x75\x65\x29\x7b\x7d')():[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x66\x61\x6c\x73\x65\x29\x7b\x7d')();}());define([_0x388b('0x0'),_0x388b('0x1'),_0x388b('0x2'),_0x388b('0x3')],function(_0x3028a2,_0x2b8a5d,_0x2d28ad){'\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74';var _0x3f4c6f=window;var _0xdbd1a4;var _0x4ec789;var _0x34fb92=_0x3f4c6f[_0x388b('0x4')];var _0x26d8c0=_0x3f4c6f['\x50\x69\x77\x69\x6b']||null;var _0x2a70e2=[];var _0x14b5fa=_0x3028a2[_0x388b('0x5')]('\x68\x65\x6e\x68\x65\x64\x2d\x70\x69\x77\x69\x6b')['\x6c\x6f\x63\x61\x6c\x53\x74\x6f\x72\x61\x67\x65'];function _0xa011c1(_0x2cd798){if(_0x26d8c0===null){_0x3028a2(_0x388b('0x8'))[_0x388b('0x7')](_0x388b('0x9'),'\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74')[_0x388b('0x7')]('\x61\x73\x79\x6e\x63',!![])['\x61\x74\x74\x72'](_0x388b('0xa'),!![])[_0x388b('0x7')](_0x388b('0xb'),_0x2cd798)[_0x388b('0x6')](_0x388b('0xc'));return!![];}return![];}function _0x1cf11f(){if(_0x26d8c0){_0x2b8a5d[_0x388b('0xd')](_0x2a70e2,function(_0x2f5fe3){_0x2f5fe3[_0x388b('0xe')](_0x26d8c0);});}else{_0x2b8a5d[_0x388b('0xd')](_0x2a70e2,function(_0x126e47){_0x126e47['\x72\x65\x6a\x65\x63\x74']();});}}function _0x543f9d(){if(_0x2b8a5d['\x69\x73\x46\x75\x6e\x63\x74\x69\x6f\x6e'](_0x34fb92)){_0x34fb92();}_0x26d8c0=_0x2b8a5d[_0x388b('0xf')](_0x3f4c6f[_0x388b('0x10')])?_0x3f4c6f[_0x388b('0x10')]:![];if(_0xdbd1a4&&_0x4ec789){_0x1cf11f();}}function _0x533af9(){var _0x245333=_0x3028a2[_0x388b('0x11')]();if(_0x26d8c0===null||!_0xdbd1a4||!_0x4ec789){_0x2a70e2['\x70\x75\x73\x68'](_0x245333);}else if(_0x26d8c0===![]){_0x245333[_0x388b('0x12')]();}else{_0x245333['\x72\x65\x73\x6f\x6c\x76\x65'](_0x26d8c0);}return _0x245333[_0x388b('0x13')]();}function _0x73ad71(){var _0x32e45a=_0x3028a2[_0x388b('0x11')]();_0x533af9()[_0x388b('0x14')](function(_0x162a16){_0x32e45a['\x72\x65\x73\x6f\x6c\x76\x65'](_0x162a16[_0x388b('0x15')]());})['\x66\x61\x69\x6c'](function(){_0x32e45a[_0x388b('0x12')]();});return _0x32e45a['\x70\x72\x6f\x6d\x69\x73\x65']();}function _0x247803(_0x4e1eca,_0x2afd54){var _0x5cdc87=_0x3028a2[_0x388b('0x11')]();_0x533af9()[_0x388b('0x14')](function(_0xbc646c){_0x5cdc87[_0x388b('0xe')](_0xbc646c[_0x388b('0x16')](_0x4e1eca||_0x4ec789,_0x2afd54||_0xdbd1a4));})['\x66\x61\x69\x6c'](function(){_0x5cdc87[_0x388b('0x12')]();});return _0x5cdc87[_0x388b('0x13')]();}function _0x42887e(_0x4ba049,_0xd641ce){if(!_0x2b8a5d[_0x388b('0x17')](_0x4ba049)||_0x2b8a5d['\x69\x73\x45\x6d\x70\x74\x79'](_0x4ba049)){return;}else if(_0x2b8a5d[_0x388b('0x17')](_0x2b8a5d[_0x388b('0x18')](_0x4ba049))){_0x2b8a5d[_0x388b('0xd')](_0x4ba049,function(_0x310a1f){_0x42887e(_0x310a1f,_0xd641ce);});}else if(_0x2b8a5d[_0x388b('0xf')](_0xd641ce)){var _0x2d78e5=_0x4ba049[_0x388b('0x19')]();if(_0x2b8a5d[_0x388b('0x1a')](_0xd641ce[_0x2d78e5])){_0xd641ce[_0x2d78e5][_0x388b('0x1b')](_0xd641ce,_0x4ba049);}}else{_0x3f4c6f['\x5f\x70\x61\x71'][_0x388b('0x1c')](_0x4ba049);}}function _0x21f67b(_0x2d2922){if(_0x2b8a5d[_0x388b('0x1d')](_0x2d2922,_0x388b('0x1e'))){if(_0x14b5fa['\x67\x65\x74'](_0x388b('0x1f'))===_0x2d2922[_0x388b('0x1e')]){return;}else{_0x14b5fa['\x73\x65\x74'](_0x388b('0x1f'),_0x2d2922[_0x388b('0x1e')]);}}if(_0x2b8a5d[_0x388b('0x1d')](_0x2d2922,_0x388b('0x20'))){_0x247803()[_0x388b('0x14')](function(_0x4225cf){_0x42887e(_0x2d2922[_0x388b('0x20')],_0x4225cf);});}}function _0x233344(_0x69cb2d){_0x42887e([[_0x388b('0x21'),_0xdbd1a4=_0x69cb2d[_0x388b('0x22')]],['\x73\x65\x74\x54\x72\x61\x63\x6b\x65\x72\x55\x72\x6c',_0x4ec789=_0x69cb2d[_0x388b('0x23')]]]);_0x42887e(_0x69cb2d['\x61\x63\x74\x69\x6f\x6e\x73']);if(!_0xa011c1(_0x69cb2d[_0x388b('0x24')])){_0x1cf11f();}}_0x3f4c6f[_0x388b('0x25')]=_0x3f4c6f['\x5f\x70\x61\x71']||[];_0x3f4c6f[_0x388b('0x4')]=_0x543f9d;_0x2d28ad['\x67\x65\x74']('\x63\x61\x72\x74')[_0x388b('0x26')](_0x21f67b);return{'\x63\x72\x65\x61\x74\x65\x54\x72\x61\x63\x6b\x65\x72':_0x247803,'\x67\x65\x74\x50\x69\x77\x69\x6b':_0x533af9,'\x67\x65\x74\x54\x72\x61\x63\x6b\x65\x72':_0x73ad71,'\x70\x75\x73\x68':_0x42887e,'\x48\x65\x6e\x68\x65\x64\x5f\x50\x69\x77\x69\x6b\x2f\x6a\x73\x2f\x74\x72\x61\x63\x6b\x65\x72':_0x233344};});

I hope this helps you,
Cheers

@viktor-zhuromskyy
Copy link
Author

Thank you for your time responding here.

@viktor-zhuromskyy
Copy link
Author

viktor-zhuromskyy commented Nov 7, 2016

Great advice, but I had a few hickups though.
Placing requirejs-config.js under theme's root did not work, but placing it under app/design/frontend/Devdesco/endohaus/Henhed_Piwik/web/js worked fine.

Also, the obfuscator you suggested, does not do a proper job. I used the https://javascriptobfuscator.com/ and it properly obfuscated the tracker.js script.

var _0x9ca1=["\x6A\x71\x75\x65\x72\x79","\x75\x6E\x64\x65\x72\x73\x63\x6F\x72\x65","\x4D\x61\x67\x65\x6E\x74\x6F\x5F\x43\x75\x73\x74\x6F\x6D\x65\x72\x2F\x6A\x73\x2F\x63\x75\x73\x74\x6F\x6D\x65\x72\x2D\x64\x61\x74\x61","\x6A\x71\x75\x65\x72\x79\x2F\x6A\x71\x75\x65\x72\x79\x2D\x73\x74\x6F\x72\x61\x67\x65\x61\x70\x69","\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x70\x69\x77\x69\x6B\x41\x73\x79\x6E\x63\x49\x6E\x69\x74","\x50\x69\x77\x69\x6B","\x6C\x6F\x63\x61\x6C\x53\x74\x6F\x72\x61\x67\x65","\x68\x65\x6E\x68\x65\x64\x2D\x70\x69\x77\x69\x6B","\x69\x6E\x69\x74\x4E\x61\x6D\x65\x73\x70\x61\x63\x65\x53\x74\x6F\x72\x61\x67\x65","\x68\x65\x61\x64","\x61\x70\x70\x65\x6E\x64\x54\x6F","\x73\x72\x63","\x61\x74\x74\x72","\x64\x65\x66\x65\x72","\x61\x73\x79\x6E\x63","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x3C\x73\x63\x72\x69\x70\x74\x3E","\x72\x65\x73\x6F\x6C\x76\x65","\x65\x61\x63\x68","\x72\x65\x6A\x65\x63\x74","\x69\x73\x46\x75\x6E\x63\x74\x69\x6F\x6E","\x69\x73\x4F\x62\x6A\x65\x63\x74","\x70\x75\x73\x68","\x70\x72\x6F\x6D\x69\x73\x65","\x66\x61\x69\x6C","\x67\x65\x74\x41\x73\x79\x6E\x63\x54\x72\x61\x63\x6B\x65\x72","\x64\x6F\x6E\x65","\x67\x65\x74\x54\x72\x61\x63\x6B\x65\x72","\x69\x73\x41\x72\x72\x61\x79","\x69\x73\x45\x6D\x70\x74\x79","\x66\x69\x72\x73\x74","\x73\x68\x69\x66\x74","\x61\x70\x70\x6C\x79","\x5F\x70\x61\x71","\x64\x61\x74\x61\x5F\x69\x64","\x68\x61\x73","\x63\x61\x72\x74\x2D\x64\x61\x74\x61\x2D\x69\x64","\x67\x65\x74","\x73\x65\x74","\x70\x69\x77\x69\x6B\x41\x63\x74\x69\x6F\x6E\x73","\x73\x65\x74\x53\x69\x74\x65\x49\x64","\x73\x69\x74\x65\x49\x64","\x73\x65\x74\x54\x72\x61\x63\x6B\x65\x72\x55\x72\x6C","\x74\x72\x61\x63\x6B\x65\x72\x55\x72\x6C","\x61\x63\x74\x69\x6F\x6E\x73","\x73\x63\x72\x69\x70\x74\x55\x72\x6C","\x73\x75\x62\x73\x63\x72\x69\x62\x65","\x63\x61\x72\x74"];define([_0x9ca1[0],_0x9ca1[1],_0x9ca1[2],_0x9ca1[3]],function(_0xf145x1,_0xf145x2,_0xf145x3){_0x9ca1[4];var _0xf145x4=window;var _0xf145x5;var _0xf145x6;var _0xf145x7=_0xf145x4[_0x9ca1[5]];var _0xf145x8=_0xf145x4[_0x9ca1[6]]|| null;var _0xf145x9=[];var _0xf145xa=_0xf145x1[_0x9ca1[9]](_0x9ca1[8])[_0x9ca1[7]];function _0xf145xb(_0xf145xc){if(_0xf145x8=== null){_0xf145x1(_0x9ca1[18])[_0x9ca1[13]](_0x9ca1[16],_0x9ca1[17])[_0x9ca1[13]](_0x9ca1[15],true)[_0x9ca1[13]](_0x9ca1[14],true)[_0x9ca1[13]](_0x9ca1[12],_0xf145xc)[_0x9ca1[11]](_0x9ca1[10]);return true};return false}function _0xf145xd(){if(_0xf145x8){_0xf145x2[_0x9ca1[20]](_0xf145x9,function(_0xf145xe){_0xf145xe[_0x9ca1[19]](_0xf145x8)})}else {_0xf145x2[_0x9ca1[20]](_0xf145x9,function(_0xf145xe){_0xf145xe[_0x9ca1[21]]()})}}function _0xf145xf(){if(_0xf145x2[_0x9ca1[22]](_0xf145x7)){_0xf145x7()};_0xf145x8= _0xf145x2[_0x9ca1[23]](_0xf145x4.Piwik)?_0xf145x4[_0x9ca1[6]]:false;if(_0xf145x5&& _0xf145x6){_0xf145xd()}}function _0xf145x10(){var _0xf145xe=_0xf145x1.Deferred();if(_0xf145x8=== null|| !_0xf145x5||  !_0xf145x6){_0xf145x9[_0x9ca1[24]](_0xf145xe)}else {if(_0xf145x8=== false){_0xf145xe[_0x9ca1[21]]()}else {_0xf145xe[_0x9ca1[19]](_0xf145x8)}};return _0xf145xe[_0x9ca1[25]]()}function _0xf145x11(){var _0xf145xe=_0xf145x1.Deferred();_0xf145x10()[_0x9ca1[28]](function(_0xf145x8){_0xf145xe[_0x9ca1[19]](_0xf145x8[_0x9ca1[27]]())})[_0x9ca1[26]](function(){_0xf145xe[_0x9ca1[21]]()});return _0xf145xe[_0x9ca1[25]]()}function _0xf145x12(_0xf145x13,_0xf145x14){var _0xf145xe=_0xf145x1.Deferred();_0xf145x10()[_0x9ca1[28]](function(_0xf145x8){_0xf145xe[_0x9ca1[19]](_0xf145x8[_0x9ca1[29]](_0xf145x13|| _0xf145x6,_0xf145x14|| _0xf145x5))})[_0x9ca1[26]](function(){_0xf145xe[_0x9ca1[21]]()});return _0xf145xe[_0x9ca1[25]]()}function _0xf145x15(_0xf145x16,_0xf145x17){if(!_0xf145x2[_0x9ca1[30]](_0xf145x16)|| _0xf145x2[_0x9ca1[31]](_0xf145x16)){return}else {if(_0xf145x2[_0x9ca1[30]](_0xf145x2[_0x9ca1[32]](_0xf145x16))){_0xf145x2[_0x9ca1[20]](_0xf145x16,function(_0xf145x18){_0xf145x15(_0xf145x18,_0xf145x17)})}else {if(_0xf145x2[_0x9ca1[23]](_0xf145x17)){var _0xf145x19=_0xf145x16[_0x9ca1[33]]();if(_0xf145x2[_0x9ca1[22]](_0xf145x17[_0xf145x19])){_0xf145x17[_0xf145x19][_0x9ca1[34]](_0xf145x17,_0xf145x16)}}else {_0xf145x4[_0x9ca1[35]][_0x9ca1[24]](_0xf145x16)}}}}function _0xf145x1a(_0xf145x1b){if(_0xf145x2[_0x9ca1[37]](_0xf145x1b,_0x9ca1[36])){if(_0xf145xa[_0x9ca1[39]](_0x9ca1[38])=== _0xf145x1b[_0x9ca1[36]]){return}else {_0xf145xa[_0x9ca1[40]](_0x9ca1[38],_0xf145x1b[_0x9ca1[36]])}};if(_0xf145x2[_0x9ca1[37]](_0xf145x1b,_0x9ca1[41])){_0xf145x12()[_0x9ca1[28]](function(_0xf145x17){_0xf145x15(_0xf145x1b[_0x9ca1[41]],_0xf145x17)})}}function _0xf145x1c(_0xf145x1d){_0xf145x15([[_0x9ca1[42],_0xf145x5= _0xf145x1d[_0x9ca1[43]]],[_0x9ca1[44],_0xf145x6= _0xf145x1d[_0x9ca1[45]]]]);_0xf145x15(_0xf145x1d[_0x9ca1[46]]);if(!_0xf145xb(_0xf145x1d[_0x9ca1[47]])){_0xf145xd()}}_0xf145x4[_0x9ca1[35]]= _0xf145x4[_0x9ca1[35]]|| [];_0xf145x4[_0x9ca1[5]]= _0xf145xf;_0xf145x3[_0x9ca1[39]](_0x9ca1[49])[_0x9ca1[48]](_0xf145x1a);return {createTracker:_0xf145x12,getPiwik:_0xf145x10,getTracker:_0xf145x11,push:_0xf145x15,"\x48\x65\x6E\x68\x65\x64\x5F\x50\x69\x77\x69\x6B\x2F\x6A\x73\x2F\x74\x72\x61\x63\x6B\x65\x72":_0xf145x1c}})

@henkelund
Copy link
Collaborator

Ok, I'm glad you made it work!

Strange thing that requirejs-config.js didn't work in the theme for you. It worked for me with Magento 2.1.2 in developer mode, though I had to clear the pub/static/ folder.

Anyways, does that mean you're all set now? Do you recive tracking data even with Adblock enabled?

@viktor-zhuromskyy
Copy link
Author

I edited previous post.
Now I receive all tracking data despite Adblock extensions enabled. It's a wonder!
Also, on top of JS tracking, I managed Nginx logging in JSON format, and do nightly imports of visitor logs into Piwik. This way I am getting full tracking IMHO.

@viktor-zhuromskyy
Copy link
Author

After a bit of playing around, finally I decided to avoid using requirejs-config.js because it does not actually rewrite calls to Henhed_Piwik/js/tracker in henerated HTML. So I went ahead and did template rewrite in app/design/frontend/Devdesco/endohaus/Henhed_Piwik/templates/piwik.phtml on line 26:

'Henhed_Piwik/js/tracker' => $block->getJsOptions()
to
'js/ihats' => $block->getJsOptions()

@henkelund
Copy link
Collaborator

Sure, that should work as well.

I've tagged a new release, v1.2.0, based on the branch you've tested.

Thank you for your feedback

Repository owner locked and limited conversation to collaborators Nov 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants