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

Not possible to create multiple Piwik tracker instances having different API urls #14

Open
tsteur opened this issue Oct 7, 2015 · 4 comments
Labels
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Oct 7, 2015

Because $URL is a constant and not a property of the class: https://github.com/piwik/piwik-php-tracker/blob/1.0.0/PiwikTracker.php#L32

$tracker1 = new \PiwikTracker(1, 'http://demo.piwik.org/piwik.php');
$tracker2 = new \PiwikTracker(1, 'http://apache.piwik/piwik.php');

Both tracker instances will use http://apache.piwik/piwik.php as URL.

Use case see matomo-org/matomo#4589 where up to 3 trackers can be configured and we need to send the same data to different trackers.

@tsteur
Copy link
Member Author

tsteur commented Feb 4, 2019

Ran into the issue again... causing wrong tracking results... this behaviour is totally unexpected.

It would be an easy change to a local property instead of a global static property but it may cause issues re backwards compatibility.

Any thoughts @mattab ?

@tsteur
Copy link
Member Author

tsteur commented Feb 4, 2019

BTW we ran into this issue several times now

@diosmosis
Copy link
Member

Think we can just add an API URL property and change self::$URL as usual. Anyone that relies on the $URL property would have the same broken behavior, but the tracker would work properly.

@tsteur
Copy link
Member Author

tsteur commented Feb 4, 2019

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants