By appending some code, Google Analytics can track data from shopping carts in your own domain or even other domains. If your store website is in a different subdomain or domain from your primary website, configure your webpage according to the following instructions.
If your website starts the purchase checkout process for other subdomains (for examplewww.mystore.com
Sendshoppingcart.mystore.com
):
Add the following lines (in bold) to the tracking code on your shop website and shopping cart page:
<script type=quot;text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._setDomainName("mystore.com");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script>
If your website starts the purchase checkout process on other store websites (for example, if youwww.mystore.com
Sendwww.securecart.com
):
- Add the following lines to the tracking code on your shop website and shopping cart page. This code must occur above the code in step 1.
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script>
- Change the link from the main website to the secure website to use as follows:
_link
. Please note that your Google Analytics tracking code and_gat._getTracker
Must be placed in_link
The top of the call. If your current link is as follows:<A href = "https://www.securecart.com /? Store = Parameters "> buy now </a>
Change it:
<A href = "https://www.securecart.com /? Store = Parameters "onclick =" pagetracker. _ Link (this. href); Return false; "> buy now </a>
Regardless of whether Javascript is enabled, the above Code can provide a link to the user. Note that the escape character should be a backslash when it appears in the link or link text.
Important:If your webpage contains a call to _ trackpageview (), _ Link (), _ tracktrans (), or _ linkbypost (), your Analytics (Analysis) tracking code should be placed above these calls in HTML code. In this case, the trace code can be placed anywhere between the start <body> flag and JavaScript call.
If you use a form to send information to the shopping cart, use:
<form name="post_form" method="post" onsubmit="pageTracker._linkByPost(this)">
Important:If your webpage contains a call to _ trackpageview (), _ Link (), _ tracktrans (), or _ linkbypost (), your Analytics (Analysis) tracking code should be placed above these calls in HTML code. In this case, the trace code can be placed anywhere between the start <body> flag and JavaScript call.