Multiple Google Analytics Properties

43 views
Skip to first unread message

SAAS

unread,
Feb 23, 2017, 6:27:59 AM2/23/17
to Cookie Control Support
Hi,

Just purchased the single domain version of the product.

I have two properties in Google Analytics. One applies to the www.ourdomain.com site, and the other property is for the ourportal.ourdomain.com site.

I only want the cookie control to be visible on the www.ourdomain.com site, not the ourportal one, but I need the cookie control to turn Google Analytics on and off for both properties. How do I achieve this?

I saw an old post on this topic from 2013, but when I followed the link posted I didn't see anything that seemed appropriate.

Thanks

Gerasimos Tzoganis

unread,
Feb 23, 2017, 6:39:45 AM2/23/17
to Cookie Control Support
Hi,

If you are using universal analytics, you can find instructions here on how to fire it in Cookie Control.

The only difference in your case would be that you could put the "create" command inside an if, like so:
if (document.location.hostname === 'ourportal.ourdomain.com') {
   ga
('create', 'UA-XXXXXXXX-X', 'ourportal.ourdomain.com');
} else {
   ga
('create', 'UA-YYYYYYYY-Y', 'www.ourdomain.com');
}


So depending on the domain in each case the appropriate key will be used.

I hope this helps.

Regards,
Gerasimos

SAAS

unread,
Feb 26, 2017, 3:33:42 AM2/26/17
to Cookie Control Support
Thanks Gerasimos,

Does the code above mean that I need to have the cookie control Javascript included on each page of the ourportal.ourdomain.com site?

I was hoping to only have to have the cookie control widget and JavaScript on www.ourdomain.com but apply to both domains, with the two different Property ID cookies being utilised if the user chose to allow cookies.

The code above suggests to me that I'd need to include the cookie control JavaScript on both domains. Am I understanding this wrong? I could use a single Property ID for both sites, but I'd much rather separate them with different Property IDs.

Regards

Gerasimos Tzoganis

unread,
Feb 27, 2017, 4:13:29 AM2/27/17
to Cookie Control Support
Hello,

Cookie Control's widget and JavaScript, do need to be on both domains. If you put it in only one of them, since it's only a client side tool with no server side functionality, it has no way to run when a user visits the other domain.

Regards
Reply all
Reply to author
Forward
0 new messages