Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

Google Analytics Tracking

Hi,

Can I place two google analytics visitor code on same page? Also can I place two google analytics conversion code on single thanks page?


Thanks,

David
0
david_php
Asked:
david_php
  • 4
  • 3
1 Solution
 
brutaldevCommented:
Yes. More information on pushing to multiple accounts can be found here: http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html
Directly from the page, you can track page views to multiple accounts using this example code:
 
_gaq.push(
  ['_setAccount', 'UA-XXXXX-1'],
  ['_trackPageview'],
  ['b._setAccount', 'UA-XXXXX-2'],
  ['b._trackPageview']
);

Open in new window

0
 
david_phpAuthor Commented:
thank you very much. i'll try and let you know if any probelm
0
 
david_phpAuthor Commented:
Hi,

I have tried to code and its works, its is tracking the visit in both the account but sales is only tracking in the new GA a/c not it old a/c I am sending you my thanks page code please let me know where I am wrong.. May is there a problem of Cookie

--
Thnaks
David
GA.txt
0
Sign your company up to try the MB 660 headset now

Take control and stay focused in noisy open office environments with the MB 660. By reducing background noise, you can revitalize your office and improve concentration.

 
brutaldevCommented:
I can see the problem. Take a look at the sample code above. You can see that you are setting the commands twice (eg: _trackPageview) by de-referencing it with 'b':

// First account is not de-referenced with anything
['_setAccount', 'UA-XXXXX-1'],
['_trackPageview'],
// Second account assigned to b (in front)
['b._setAccount', 'UA-XXXXX-2'],
['b._trackPageview']

Open in new window


You can push to even more accounts and commands by using different references to differentiate which account it's going to.

Hope that explains it, so to get you code working you need to make multiple pushes (like the code above or in separate calls) to the main account as well as the second account set on 'b'. Attached your code with examples of how to do this.
 GA.txt
0
 
david_phpAuthor Commented:
Hi,

Thanks for your help again I have implemented the code which u have provided to me and its starts tracking the sales code in both a/c but the problem is Purchase Product is still not  tracking in the Old A/c,

If I m not wrong shall I also need push the data twice for both the a/c

_gaq.push(['_addItem'...
_gaq.push(['b._addItem'

I am also attaching the code which I have implemented

--
Thanks
David
GA-New.txt
0
 
brutaldevCommented:
Hi david_php,

That is correct, you need to duplicate every push to the second account. I left it out in my previous example on purpose (says so in the comment) so that you could have the opportunity to add it yourself.

Think it did the trick though cause you understand now how and why this works.
0
 
david_phpAuthor Commented:
done
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now