Using Multiple Piwik Tracker Not Working?


#1

I have multiple domains sending traffic to one product. This product is located on another domain. Well I want to track the conversions from all these domains sending in traffic to our product website. I thought using this code below would solve this, but it did not. The conversions do not appear. If I use the regular code with one ID it works fine, but I need to track all of our websites sending traffic.


<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mydomain.com/piwik/" : "http://mydomain.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 3);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 5);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 6);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 7);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 8);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 10);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 11);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 12);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 13);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 14);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 15);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 16);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 17);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 18);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 19);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 20);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 21);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 22);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 23);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 24);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 25);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 26);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}catch( err ) {}
</script><noscript><p><img src="http://mydomain.com/piwik/piwik.php?idsite=21" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Tag -->


(Matthieu Aubry) #2

To do that ai recommend to set the product page as a GOAL in Piwik
Then you will see for this GOAL all the website referrers. SO you can track with only 1 piwik but get all referrers to people who visited the page


#3

I don’t understand what you just said… Or are trying to say…


#4

I do have the product page set as a goal. I can see the conversions come in if I just list one site. But when I try to list all them, nothing shows up… Can you please explain?


(vipsoft) #5

Your JavaScript has a syntax error. Every try { … } needs a catch (e) { … } block.


#6

[quote=vipsoft]
Your JavaScript has a syntax error. Every try { … } needs a catch (e) { … } block.[/quote]

Are you saying it needs to look like this below…


try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}catch( err ) {}

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
}catch( err ) {}

And so on… If you don’t mind could you be a bit more descriptive. You also used (e) instea of (err)?


(Matthieu Aubry) #7

yes


#8

[quote=matt]
yes[/quote]

thanks man got it working… I was going to give you rep, but does not look like this forum supports that feature / option.


#9

@vipsoft I am having an issue again. It does not seem to be working properly. However our site 21 is working fine. We are tracking conversions from the other sites, but they are not consistent. It’s like the data is being shared across every site or something. I wonder why site 21 is working just fine and is consistent?

Can you look at my code again to make sure it’s correct. Maybe it has something to do with

at the end?


#10

hi,I have a question,I’m Chinese,My English is poor,Please understand.
I want to ask next :trackPageView With and without arguments What is the difference between.

_paq.push([‘trackPageView’,‘Variable’]);
Variable :avg_time_on_page Always 1Seconds.

_paq.push([‘trackPageView’]);
Default : avg_time_on_page Is correct,Is normal.