@lipis opened this Issue on July 10th 2017 Contributor

We want to send different events from the same projects but into two different websites..

Will it be OK to setSiteId every time we send an event or there is a better approach to this?

_paq.push(['setSiteId', 1]);
_paq.push(['trackEvent', 'foo', 'bar']);
@RMastop commented on July 10th 2017 Contributor

Hi @lipis,

It's best to use addTracker:
It depends on what version of Piwik you use how it is implemented, please find documentation on the following pages:
Piwik 2.x:
https://developer.piwik.org/2.x/guides/tracking-javascript-guide#multiple-piwik-trackers
Piwik 3.x
https://developer.piwik.org/guides/tracking-javascript-guide#multiple-piwik-trackers

Regards,
Richard

@lipis commented on July 10th 2017 Contributor

This is duplicating.. (I guess I had to be more clear). I want to send to a different website depending on the kind of event.

Some events will go to ID: 1 and some will go to ID: 2

@RMastop commented on July 10th 2017 Contributor

Ah OK,
A new use case ;)

The problem with your solution, could be that other tracking requests, the ones that will be tracked after the
_paq.push(['trackEvent',`` 'foo', 'bar']);
will end up in the wrong ID.

Make sure you reset
setSiteId
to the default ID after the tracked event.

@lipis commented on July 10th 2017 Contributor

Yes, that's our plan.. thank you @RMastop

This Issue was closed on July 10th 2017
Powered by GitHub Issue Mirror