Opened 23 months ago

Closed 5 weeks ago

Last modified 5 weeks ago

#3220 closed Bug (fixed)

PHP API has an effect on Piwik option piwikUrl

Reported by: braekling Owned by: mattab
Priority: low Milestone: 2.2.0 - Piwik 2.2.0
Component: Core Keywords: PHP, API, piwikUrl, SitesManager.getJavascriptTag
Cc: Sensitive: no

Description

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?

Change History (10)

comment:1 Changed 22 months ago by matt (mattab)

  • Milestone set to 1.8.2 - Piwik 1.8.2

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

See #3080

comment:2 Changed 18 months ago by matt (mattab)

  • Owner set to matt

comment:3 Changed 13 months ago by matt (mattab)

  • Milestone changed from 1.12 - The Great 1.x Backlog to 2.x - Piwik 2.x

comment:4 Changed 12 months ago by matt (mattab)

  • Owner matt deleted

comment:5 Changed 2 months ago by matt (mattab)

  • Priority changed from normal to low

comment:6 Changed 2 months ago by matt (mattab)

  • Milestone changed from 2.x - The Great Piwik 2.x Backlog to 2.1 - Piwik 2.1

comment:7 Changed 2 months ago by matt (mattab)

  • Milestone changed from 2.1 - Piwik 2.1 to 2.2 - Piwik 2.2

Entering 2.1 RC cycle, moving all other tickets to 2.2 milestone!

comment:8 Changed 5 weeks ago by matt (mattab)

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!

comment:9 Changed 5 weeks ago by matt (mattab)

  • Owner set to mattab
  • Resolution set to fixed
  • Status changed from new to closed

In 81dec6dbbc4c22eab7bf07847dcc288b82a05e3c:

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!

Note: See TracTickets for help on using tickets.