[Solved] Hide URL issues with piwik.php

I am running Arch with Piwik on NGINX and just recently tracking using the hide your URL method has been getting messed up as far as the triggering of the goals. Everything was working fine until a few days ago, and the 2 sites I still do not have tracking with the hidden URL are tracking goals fine.

I get a variety of errors but they are stating the same basic thing

2013/04/13 15:51:54 [error] 2802#0: *9 FastCGI sent in stderr: "PHP message: PHP Warning:  sprintf(): Too few arguments in /my/site/piwik.php on line 69" while reading response header from upstream, client:, server: , request: "GET /piwik.php?action_name=My%20Website%20Title!&idsite=978&rec=1&r=371635&h=11&m=51&s=52&url=http%3A%2F%2Fwww.mysite.com%2Fo%2Fgfg%2Fheater%2F1%2F&_id=b0686e49aa174610&_idts=1364004010&_idvc=23&_idn=0&_refts=1365868313&_viewts=1365860923&_ref=http%3A%2F%2Ffleshbot.com%2F&cookie=1&res=1280x800 HTTP/1.1", upstream: "fastcgi://", host: "mywebsite.com", referrer: "http://www.mywebsite.com/w/gfg/heater/1/"

It is always line 69 in piwik.php it hits this. Does anyone know why this is happening or why it is sending too few arguments? I can post more of these that are in the logs, but the one posted was modified to remove my actual site and directory structure. I changed nothing in my configuration when this error started happening so much it longer was tracking anything other than the site visit. There were some recent updates to PHP and that is the only thing I can think of.

Thanks for the help.

This bug is fixed in latest beta: Index of /

@Matt is the only way to solve it too run the entire beta version or just take out the piwik.php file?

Thank you for your time!

Just that file should fix it

Cool thanks will report back either way.

Sadly that was the version I had already pulled from GitHub thinking mine was out of date and I still have that error in my logs.

I DL’d piwik-1.12-b9.tar.gz
took the file from /piwik/misc/proxy-hide-piwik-url/

EDIT: and I did a vimdiff on my orig piwik.php vs the new one and the only things different were of course the things I am suppose to set. The rest of the file was identical. Thanks.

Well left it to run for the entire night and still have those errors, seems as though roughly 90% of my traffic triggers this, so I see no improvement using the one in GitHub master.

You mentioned you updated php, how about nginx itself could there be an update to it that might help?

I am on the most current version of everything on that box for Arch Linux. And checking with their upstream counterparts, they are all the most current stable version available as it should be.

I just stated the php error as it was the most recent update that could have had something to do with the errors starting up for me. It is just weird I did not have this problem until recently. Honestly did not see this until a couple days after the most recent php changes. Then I went to GitHub and DL’d the most current version available there and have had that running for roughly 2 days before posting the issue on the boards.

nginx -v
nginx version: nginx/1.2.8

php -v
PHP 5.4.14 (cli) (built: Apr 11 2013 19:13:00) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies


Anyone have any other ideas on this? How am I the only one hit by this? Guess will open a bug report as well.

edit: For refference here is where I added my info the Hide URL ticket. Document how to hide piwik server URL in the Javascript · Issue #2019 · matomo-org/matomo · GitHub

I pushed a fix for the bug, if you try the latest proxy-hide-piwik-url/piwik.php from GIT it should work!

Hi Matt,

Thanks for the update on the issue, while yes this does solve the issue of the error showing up in the logs, I am not showing any goals being tracked still, just like it was before. But now there is no errors in any logs relating to it. It just does not track goals.

Any other ideas? Or anything else from my logs that I can share that would be of help here?

Thank you.

Well 2 errors have shown up in the logs now again both basically the same like before but now stating an issue on line 73.

2013/04/16 21:13:43 [error] 8125#0: *426 FastCGI sent in stderr: "PHP message: PHP Warning:  file_get_contents(http://my.intermal.i.p/piwik.php?cip=end.user.i.p&token_auth=1234dc5cxdff61e70e76d7b8deb9cef65&action_name=My+Site+Title%21&idsite=1056&rec=1&r=878845&h=2&m=12&s=33&url=http%3A%2F%2Fwww.mysite.com%2F&_id=a42d0858ed9c82ea&_idts=1366146814&_idvc=1&_idn=1&_refts=0&_viewts=1366146814&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=1&java=0&gears=0&ag=0&cookie=1&res=1024x768&): failed to open stream: HTTP request failed!  in /my/site/location/piwik.php on line 73" while reading response header from upstream, client: end.user.i.p, server: , request: "GET /piwik.php?action_name=My%20Site%20Title&idsite=1056&rec=1&r=878845&h=2&m=12&s=33&url=http%3A%2F%2Fwww.mysite.com%2F&_id=a42d0858ed9c82ea&_idts=1366146814&_idvc=1&_idn=1&_refts=0&_viewts=1366146814&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=1&java=0&gears=0&ag=0&cookie=1&res=1024x768 HTTP/1.1", upstream: "fastcgi://", host: "mysite.com", referrer: "http://www.mysite.com/"

Still seems like its piwik.php causing the errors. Also I modified the log entry to remove IP’s URL’s Site Title. Box was even rebooted after this change just to make sure everything was fresh and to make sure I was not experiencing any other issues. The Live Vistors and actual site tracking of the hits seems OK still, its just everything else. Never saw this issue on 1.10* . If I can share anything else please let me know.


@Matt OK well since you do want this in the bug ticket as well here is what you asked for from that put in here.

I have waited 3 hours since putting it in and still only 5 of the 40 triggers of the goal done by myself have shown up. I know it takes a few seconds. And there have been 27K+ visits since then and 0 goals have been triggered since the change. So my total goals that were triggered today is 5. This happens on every single site I am tracking, Goals are not working when using the hideURL … Go back to the standard method and all is OK.

I get that it works for you, but that does not mean it works for all obviously.

To reproduce:

  1. Update to whatever version you say “works”
  2. Reload the webserver and web accelerator where piwik.php is kept
  3. Visit page
  4. Trigger goals
  5. Wait and watch no goals get triggered.

In that case, can you try to Debug the request using this guide: http://piwik.org/docs/tracking-api/reference/#toc-debugging-the-tracking-api-requests

Probably a dumb question but do you want what firebug says for the headers and response from piwik.php. Or am I looking in the logs for more detailed error messages to appear? The error I posted previously is not on every request it has only shown a couple times in the logs.

Or maybe I am not getting this part in the instructions you linked to
If the requests are triggered from your app or software directly, you can output or log the Tracking URL piwik.php?… and manually load it to view the logging messages.


Enable debug in piwik.php

Then trigger the goal request. With firebug look at piwik.php URL.

open this url in a new tab. You should see debug message. THe URL should contain &idgoal=X whatever goal you triggered.

The message should explain why the goal is not tracked if you expected it to track.

Thanks Matt for that, for some reason I was not thinking of getting the correct things earlier.

I see the error and trying some changes in the code to make sure this is not my issue now.

Thanks Matt and the other devs. It is working all for me again. The last fix got the error solved and your tips for the debugging showed the rest of the issue was just my code adding in my URL a second time causing the issue with the goals not triggering.