Here’s the problem I am having:
Currently, we need to track across http://www.chess.com and secure.chess.com.
However, I cannot set the domain to .chess.com because the cookie causes some problems on another domain, live.chess.com.
So, to work around this, in code – I do something like this:
<? if (HTTPS) { ?>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-01']);
_gaq.push(['_setDomainName', 'secure.chess.com']);
_gaq.push(['_trackPageview']);
</script>
<? } else { ?>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-02']);
_gaq.push(['_setDomainName', 'www.chess.com']);
_gaq.push(['_trackPageview']);
</script>
<? } ?>
However, this forces us to maintain 2 analytics accounts (UA-XXXXX-01 and UA-XXXXX-02) and creates a separation between HTTPS and HTTP traffic.
How can I set this up so that ONE analytics account will track both secure.chess.com and http://www.chess.com without setting a top level cookie (.chess.com)?
Copied from this answer:
(Where
%%HTTP_HOST%%is a variable generated by your server-side script)Edit: To confirm, the following code is included on all pages generated at secure.chess.com and http://www.chess.com and no script errors display at secure.chess.com correct?