Skip to content

Loading…

Make tracking several site IDs easier to users implementing Piwik using Asynchronous javascript #5049

Closed
mattab opened this Issue · 6 comments

2 participants

@mattab
Piwik Open Source Analytics member

It is a common use case to want to track the data in two different websites in Piwik, for example one website for the current website and another one for the "aggregate" websites collecting data across several domains.

In this case here is the recommended practise: http://developer.piwik.org/api-reference/tracking-javascript#multiple-piwik-trackers

Note: When using multiple trackers, you must use the synchronous Javascript tracker object (ie. this will not work with the asynchronous tag).

The goal of this ticket is to remove this bracket from the documentation: '(ie. this will not work with the asynchronous tag)' and make it work when calling
.push( 'setSiteId', X )
with X and Y.

This will also resolve a few support issues as this question occurs fairly often!

@tsteur
Piwik Open Source Analytics member

Isn't there already a setSiteId method? What exactly is to do here?
Otherwise another solution would be to make it possible to use two trackers when using async

@tsteur
Piwik Open Source Analytics member

Found the problem in current implementation, it always calls all setSiteId methods first... So we can either fix this or make two trackers work in async mode by using callback methods

@mattab
Piwik Open Source Analytics member

Maybe proper solution is to throw an exception when setSiteId is pushed more than once?

@tsteur
Piwik Open Source Analytics member

In 743ec5b: refs #5049 log to console (if exist) if methods, that are applied first, are registered multiple times. We do not throw an error as this would prevent script execution

@tsteur
Piwik Open Source Analytics member

In a9d8533: refs #5049 fix tracker tests, jslint was not as happy as I was

@tsteur
Piwik Open Source Analytics member

In 7c2dd6a: refs #5049 added possiblity to use async + multiple piwik trackers

@mattab mattab added this to the 2.3.0 - Piwik 2.3.0 milestone
@sabl0r sabl0r pushed a commit to sabl0r/piwik that referenced this issue
@tsteur tsteur refs #5049 log to console (if exist) if methods, that are applied fir…
…st, are registered multiple times. We do not throw an error as this would prevent script execution
743ec5b
@sabl0r sabl0r pushed a commit to sabl0r/piwik that referenced this issue
@tsteur tsteur refs #5049 fix tracker tests, jslint was not as happy as I was a9d8533
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.