Piwik hiding footprint not working?

Hi all, new to piwik, and wanted to setup the hiding the footprint of piwik as per

https://github.com/piwik/piwik/blob/master/misc/proxy-hide-piwik-url/piwik.php

v 1.10.1
allow_url_fopen On

i get the following error everytime, and on different webservers

Fatal error: Only variables can be passed by reference in [path]/piwik.php on line 112

anyone have any suggestions?

Rogul

I think there is a bug in the script.
Try changing (in line 112) from


str_replace("\n","\t","\r", "", $_SERVER['HTTP_ACCEPT_LANGUAGE'])

into


str_replace(array("\n","\t","\r"), "", $_SERVER['HTTP_ACCEPT_LANGUAGE'])

That would replace “\n”, “\t” and “\r” with “” and remove unnecessary white spaces.
For information on str_replace see http://php.net/manual/en/function.str-replace.php.

thank u the script errors are gone!

This method seems to have been broken with 1.11.1

has anyone got any info on making it work again? Im getting zero visitors tracked since the upgrade

Seems to work ok for us!

Piwik Proxy Hide URL script just works fine for me.

However, I need to set some custom variables but It seems it doesn’t work when “pushed” on javascript event.

When I use the Piwik Proxy Hide URL script, I can’t catch custom variable trigged by a javascript event.
e.g (using jQuery) :


$('#block').on('click', 'span', function(){
			_paq.push(["setCustomVariable", 1, "myVariable", $(location).attr("href"), "page"]);
			_paq.push(['trackPageView']);
		});

trackPageView does catch the custom variable. If I take a look at the http request, the javascript click event did append the custom variable as a GET parameter, but then nothing happens. It’s like the custom variable is ignored and skipped from DB.

It will work fine if I reverse to the “no proxy” async loading (just switching to the “real” piwik server url and piwik.php to piwik.js)
Any help ?

Maybe make sure that $(location).attr(“href”) is a string or something like this?

If you are able, you can debug your call to check the custom variable values work well: http://piwik.org/docs/tracking-api/reference/#toc-debugging-the-tracking-api-requests

Hello matt, I posted a new topic where I am explaining the process : Piwik proxy hide url script doesn’t route custom variables ?
I tested with a simple word as value for my custom variable, that doesn’t work either.
And debugging http request doesn’t show anything strange, the cvar is here with right value encoded.
As I explained, it does work removing the proxy script, my variables are recorded so it’s obvious it has something to do with the script.

can you use the latest version from : matomo/misc/proxy-hide-piwik-url at master · matomo-org/matomo · GitHub

That’s the version I use. I’m a meticulous person :wink:

Could you send me basic HTML page with only these few lines of code, that you have used to replicaet the problem ? thanks

Here you go matt, a RAR with 2 simple html test pages : test1.html using the proxy script and test2.html not using the script
piwik-proxy-hide-url_custom-variable-tests

I’m seeing something similar with eCommerce variables but it did occur to me that it might be related to the fact that my eCommerce var’s are only being called when the site is in secure SSL mode (HTTPS) rather than just unsecure (HTTP). This works fine when using the standard piwik.js call to the piwik server but not when using the proxy-hide-url script.

Could the connection type be having an effect?

Any clues matt ?
Did you have time to look at the test pages ?

please put them on pastebin.com

on pastebin.com:

  • using the proxy script:
    test1
  • not using the script:
    test2

@BeekerMeep, I tested the async code and it worked for me, custom variables are tracked !

Im not sure what’s happening for you. Maybe try debugging as explained in: http://piwik.org/docs/tracking-api/reference/#toc-debugging-the-tracking-api-requests

then you can see if Piwik tracks the custom variables