WP-Piwik changes link to IP
-
Instead of the link to (configured) Piwik installation, WP-Piwik changes the domain to the regarding IP (which does not work, since tehre are multiple domains and the IP does not serve a site.
-
I’m sorry, but WP-Piwik does not change your configured URL. If at all it adds a slash to your URL:
self::$aryGlobalSettings['piwik_url'] = self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:''));
(Get your entered URL.)static function checkURL($strURL) { if (empty($strURL)) return ''; if (substr($strURL, -1, 1) != '/' && substr($strURL, -10, 10) != '/index.php') $strURL .= '/'; return $strURL; }
(Add a slash if necessary.)
That’s all.
Could you please describe your problem in more detail? Maybe I missunderstand your concern.
Configured is (in my case) http://relevanzgenerator.de/piwik/
The tracking code renders
var pkBaseURL = (("https:" == document.location.protocol) ? "https://46.4.223.155/piwik/" : "http://46.4.223.155/piwik/");
This happens for my other site using WP-Piwik as well.
But the rendered BaseURL has no Piwik-Subdirectory since there is no page.
BTW: This is new with the lastest version.
Piwik itself does generate the correct tracking code.
Can you try to open this link using your browser? (Replace YOUR_PIWIK_PATH, YOUR_SITE_ID, YOUR_AUTH_TOKEN)
http://YOUR_PIWIK_PATH/index.php?module=API&method=SitesManager.getJavascriptTag&idSite=YOUR_SITE_ID&piwikUrl=&format=xml&token_auth=YOUR_AUTH_TOKEN
Are you using the REST or the PHP API?
Uh. Dammit.
I’m using REST and the link returns the wrong code. Thanks.
(I checked the code generated by piwik in the admin interface)
This seems to be exactly what you filed in http://dev.piwik.org/trac/ticket/3220
Setting the “piwikUrl” parameter to “YOUR_PIWIK_PATH” helps around this, could you implement this? (tested with the link you provided)
Hm, the PHP API should set this parameter to your configured URL already:
$strParams .= '&piwikUrl='.urlencode(self::$aryGlobalSettings['piwik_url']);
You configured the Piwik URL and the Piwik path in WP-Piwik’s settings, didn’t you?
No. I’m using the REST-Api, thus the PHP-Api-Field is wether shown nor filled.
“Piwik URL (REST API):” Field contains the (working) path to piwik.
Sorry, my fault.
But if you are using the REST API, Piwik should be able to estimate its URL by itself. After opening your configured URL you posted above I get this error message:
Warnung: You are now accessing Piwik from http://CONFIGURED_URL_WP-PIWIK/piwik/, but Piwik has been configured to run at this address: http://CONIFGURED_URL_PIWIK/piwik/.
The Piwik URL you configured in WP-Piwik corresponds not to the Piwik URL configured in Piwik itself. I suppose Piwik is not able to estimate its own URL by this reason. Please check this.
Nevertheless I’ll keep in mind to add an “piwikUrl” parameter option to WP-Piwik.
That seems to be an security feature introduced in the new Piwik Version. (and enabled by default….)
Since I have the configured a central place where piwik lives on my server and use different domains with aliases to get the script.
My problem is solved, but please do add this option!
Alright, and yes – I will do so!
Best regards
AndréThis is still the issue. The code generated has the ip instead of the URI. I cant find any way to change this from within the plugin so I have to disable to enter the code and then I manually insert the code into the footer in the theme.
Latest version of all things involved.
Solved it.
Actually if i entered http://dalnix.se/piwik i got IP instead of URI.
Entering http://www.dalnix.se/piwik everything worked just fine.The latter being the URI piwik is configured as “its” URI.
- The topic ‘WP-Piwik changes link to IP’ is closed to new replies.