AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.7K members online now
4.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

One Google Account, Two Different Code Snippets

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello all, I currently have one Google Account and use ga.js for my website. I am planning to use analytics.js for a mobile version of the site as well. Is it possible to have both of these code snippets transmitting to the same account? Are there any implications I should be aware of?

 

Thank you,

Steven 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Steven T
July 2016

Re: One Google Account, Two Different Code Snippets

[ Edited ]
Top Contributor
# 4
Top Contributor

@Steven T wrote:
Hi Bronwyn, Thank you for the reply.
So to sum it up, the full site and mobile site are not on the same site pages, the full site is using ga.js, the mobile site would be using analytics.js, but they would have the same tracking ID.

 thanks :-)

Even though the mobile site is going to have it's own site pages, different to the full site. I understand that its likely not the intention, but if either set of site pages can be accessed via different devices eg if a site visitor will be able to access the full site via their mobile or someone will be able to access the mobile site via their desktop browser, then I think customizing the ga.js history import mentioned in my first reply needs to be given some thought. 

 

"... analytics.js will automatically import any classic Google Analytics cookies previously set by ga.js ..."

https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#mult...


"Additional configuration may be required in cases where cookie information needs to be transferred from a Universal Analytics cookie to classic Google Analytics cookies set by ga.js, such as with larger websites that have not completely retagged with analytics.js and have both tracking codes present for some period of time."

https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#cust...

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

View solution in original post

Re: One Google Account, Two Different Code Snippets

Top Contributor
# 2
Top Contributor

Hi Steven :-)

You cant have ga.js or analytics.js for the same tracking id on the same site pages, it will cause conflicts.

Are they both versions of the site be using the same tracking id or were you going to use seperate properties?

 

If you are using the same Property for both versions of the site, then it will require a little extra work to have the pages with analytics..js work with the pages that have ga.js due to differences in cookies etc.

 

There is more information in the dev docs about customizing the ga.js history import.

"... analytics.js will automatically import any classic Google Analytics cookies previously set by ga.js ..."
"Additional configuration may be required in cases where cookie information needs to be transferred from a Universal Analytics cookie to classic Google Analytics cookies set by ga.js, such as with larger websites that have not completely retagged with analytics.js and have both tracking codes present for some period of time."

https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#cust...

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: One Google Account, Two Different Code Snippets

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Bronwyn, Thank you for the reply.

To answer your question, the web site and mobile version of the site are not on the same site pages, they are just using the same tracking ID.

To further explain the situation, the website would still have the old ga.js running on it, but the mobile would be the new analytics.js snippets (different site pages).

So to sum it up, the full site and mobile site are not on the same site pages, the full site is using ga.js, the mobile site would be using analytics.js, but they would have the same tracking ID.

In this case, will this work?

Thanks again,
Steven
Marked as Best Answer.
Solution
Accepted by topic author Steven T
July 2016

Re: One Google Account, Two Different Code Snippets

[ Edited ]
Top Contributor
# 4
Top Contributor

@Steven T wrote:
Hi Bronwyn, Thank you for the reply.
So to sum it up, the full site and mobile site are not on the same site pages, the full site is using ga.js, the mobile site would be using analytics.js, but they would have the same tracking ID.

 thanks :-)

Even though the mobile site is going to have it's own site pages, different to the full site. I understand that its likely not the intention, but if either set of site pages can be accessed via different devices eg if a site visitor will be able to access the full site via their mobile or someone will be able to access the mobile site via their desktop browser, then I think customizing the ga.js history import mentioned in my first reply needs to be given some thought. 

 

"... analytics.js will automatically import any classic Google Analytics cookies previously set by ga.js ..."

https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#mult...


"Additional configuration may be required in cases where cookie information needs to be transferred from a Universal Analytics cookie to classic Google Analytics cookies set by ga.js, such as with larger websites that have not completely retagged with analytics.js and have both tracking codes present for some period of time."

https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#cust...

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: One Google Account, Two Different Code Snippets

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Okay thank you very much for your help!

Re: One Google Account, Two Different Code Snippets

Top Contributor
# 6
Top Contributor
Happy to be of help :-)
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here