Reputation: 525
I'm having some trouble with google analytis. We have a site where the user lands on the landing page, fills out personal information (name, address, email etc). This site is located on http://link.<domain>
When the form is submitted, the user is directed to a secure site on https://ssl.<domain>
Where he/she fills out credit-card information.
The problem is, that the google analytics 'lose' track of the customer session. The statistics show, the referrer for the site on ssl.(domain) is the site on link. and not the actual referrer who led the user to the landing page - this of course wreaks havoc on our goal-page, which is also situated on http://link.<domain>
.
my tracking-code is
_gaq.push(
['_setAccount', "UA-XXXXXXXX-XX"],
['_setDomainName', '<domain>'],
['_trackPageview']
);
I've set the
['_setDomainName', '(domain)']
but it does not seem to help. I hope someone can help me out.
Upvotes: 0
Views: 1430
Reputation: 1
_gaq.push(['_setAllowLinker', true]);
is what you are missing. That makes Analytics track subdomains, and even different domains, together as one entity.
This is especially interesting when tracking ecommerce transactions across different domains (e.g. when your basket or checkout is handled by a third party).
The words to look up and research are "cross domain tracking".
See here for more information.
Upvotes: 0
Reputation: 4190
Sounds like you got it to work, but take a look at: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite . It seems to have the extra params you need.
Upvotes: 0
Reputation: 2383
In addition to what Crayon said, I think you will also need to use the _addIgnoredRef()
api as described here. Once you do this, you should clear your cookies and then try again. I can probably help you better if you have an actual link that I can test.
In your case, I think you'll need to use:
_gaq.push(['_addIgnoredRef', 'link.<domain>']);
Upvotes: 2
Reputation: 32517
If the domains are the same and the only difference is the subdomain, make sure that you are setting the _setDomainName
value to the root domain name (without a dot prefix).
Example:
link.yoursite.com
ssl.yoursite.com
for both, you should have on-page the following:
['_setDomainName', 'yoursite.com']
If the root domains are different, navigating to a new root domain will cause the session to break. This is because GA uses 1st party cookie tracking, and cookies on domain1.com cannot be read from domain2.com. In order to overcome this, you will also need to add _setAllowLinker
to your on-page code, and also pop additional code when the visitor clicks on the link to the ssl domain, to ensure that the GA cookie info is passed to the new domain via URL. Here is GA's reference on cross-domain tracking for more details.
Upvotes: 2