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

PHP API has an effect on Piwik option piwikUrl #3220

Closed
anonymous-matomo-user opened this issue Jun 12, 2012 · 4 comments
Closed

PHP API has an effect on Piwik option piwikUrl #3220

anonymous-matomo-user opened this issue Jun 12, 2012 · 4 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

Hi all,

using the PHP API has an effect on the Piwik option called "piwikUrl" (database table piwik_options), so Piwik proceeds on the assumption that the API-calling PHP script's URL is equal to Piwik's own URL.

Example:

Local test environment, Piwik: ...//127.0.0.1/piwik, WordPress: ...//127.0.0.1/wordpress. At the beginning piwikUrl is correctly set to ...//127.0.0.1/piwik/.

I just added a new feature to my WordPress plugin WP-Piwik: The user can choose between REST and PHP API. But if the PHP API is used (as described here: http://piwik.org/docs/analytics-api/calling-techniques/#toc-call-the-piwik-api-in-php), Piwik will change piwikUrl from ...//127.0.0.1/piwik/ to ...//127.0.0.1/wordpress/wp-admin/ (= location of the WordPress administration script including the plugin which calls the PHP API).

I think this behaviour isn't intentional, is it? It causes some annoying issues, e.g. SitesManager.getJavascriptTag returns a erroneous tracking code (see http://forum.piwik.org/read.php?2,74920).

Giving piwikUrl as a parameter to SitesManager.getJavascriptTag should be a workaround, but no reasonable solution. What's about a constant to prevent piwikUrl changes?
Keywords: PHP, API, piwikUrl, SitesManager.getJavascriptTag

@mattab
Copy link
Member

mattab commented Jun 17, 2012

Thanks for the report and suggestion. A constant sounds good. We will also update the docs.

See #3080

@mattab
Copy link
Member

mattab commented Mar 16, 2014

Hi Andre! Sorry about leaving this ticket opened so long. Do you still experience the issue? If so please comment and we will schedule to propose a solution!

@mattab
Copy link
Member

mattab commented Mar 16, 2014

In 81dec6d: Fixes #3220 When the core is not dispatching the request (PIWIK_ENABLE_DISPATCH is not set, or set to false), then getPiwikUrl will not update the value in the DB.
Thanks for the report & again sorry for such long delay to fix it!

@mattab
Copy link
Member

mattab commented Mar 16, 2014

In bc2f937: Fixes #3220 Fix logic

@anonymous-matomo-user anonymous-matomo-user added this to the 2.2.0 - Piwik 2.2.0 milestone Jul 8, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
…IWIK_ENABLE_DISPATCH is not set, or set to false), then getPiwikUrl will not update the value in the DB.

Thanks for the report & again sorry for such long delay to fix it!
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants