Hello,
I am developing an application and I need to log the visitor in two different idSite.
I have read the code
window.piwikAsyncInit = function () {
...
}
, but I can not make it work.
The following code, Premise that by tracking in a single instance works correctly.
<script type="text/javascript">
window.piwikAsyncInit = function () {
try {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://traffico-visite.eu/ns/5/";
var piwikTracker = Piwik.getTracker(u+"piwik.php", 17);
piwikTracker.appendToTrackingUrl('new_visit=1');
piwikTracker.deleteCookies();
piwikTracker.setReferrerUrl( 'http://www.mive.it' );
piwikTracker.trackPageView();
var piwikTracker2 = Piwik.getTracker(u+"piwik.php", 9);
piwikTracker2.appendToTrackingUrl('new_visit=1');
piwikTracker2.deleteCookies();
piwikTracker2.setReferrerUrl( 'http://www.mive.it' );
piwikTracker2.trackPageView();
} catch( err ) {
alert('Errore');
}
};
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://traffico-visite.eu/ns/5/";
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);
})();
</script>