@anonymous-piwik-user opened this Issue on September 26th 2012

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):

var _paq = _paq || [];
(function(){
    var u=(("https:" == document.location.protocol) ? "https://URL/" : "http://URL/");
    _paq.push(['setSiteId', 7]);
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);

    _paq.push(['setSiteId', 1]);
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);

    var d=document,
        g=d.createElement('script'),
        s=d.getElementsByTagName('script')[0];
        g.type='text/javascript';
        g.defer=true;
        g.async=true;
        g.src=u+'piwik.js';
        s.parentNode.insertBefore(g,s);
})();

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.
@robocoder commented on September 26th 2012 Contributor

No, this is the expected behaviour. You're only using one tracker.

With the async method, _paq is a proxy for an internal tracker.

@anonymous-piwik-user commented on September 26th 2012

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.

@robocoder commented on September 26th 2012 Contributor

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.

@anonymous-piwik-user commented on September 26th 2012

ok, thanks

This Issue was closed on September 26th 2012
Powered by GitHub Issue Mirror