Skip to content

PHP API has an effect on Piwik option piwikUrl #3220

@anonymous-matomo-user

Description

@anonymous-matomo-user

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

Metadata

Metadata

Assignees

Labels

BugFor errors / faults / flaws / inconsistencies etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions