When using two trackers on the same page, visits are being logged fine at both projects, but downloads are only tracked at one.
How to reproduce:
e.g. this code is being used (siteId 7 and 1):
When clicking a download (and looking at the network http requests), Piwik sends only one request instead of two:
http://URL/piwik.php?download=<MYLINK>&idsite=1&... ``` **Expected behaviour:** ...would be another request with siteId 7.
No, this is the expected behaviour. You're only using one tracker.
With the async method, _paq is a proxy for an internal tracker.
Ok, sorry maybe the "behaviour" would work with just one request (coming from _paq, don't know the technical details), but it doesn't change the fact that downloads are only tracked at one project, not both, as you'd expect.
Whereas visitors are being logged at both...isn't that contradictory? Stats are incomplete that way.
When you call setSiteId(), you're changing the tracker config. It no longer knows about site 7 when it processes the click.
This is the intended behaviour/design.