Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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
Owner

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
Owner

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
Owner

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
Owner

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

@tsteur
Owner

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
Owner

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

@tsteur
Owner

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 referenced this issue from a commit in sabl0r/piwik
@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
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.