Google Analytics E-commerce Tracking Issue - google-analytics

I have ecommerce tracking set up on my site and in google analytics. The problem is that sometimes it tracks the e-commerce sales but sometimes it doesn't.
Here is the code which is being output before my closing body tag:
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-2795368-10"]);
_gaq.push(["_trackPageview", "/checkout/onepage/success/"]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
_gaq.push(["_addTrans","100000029","","10.0000","0.0000","0.0000","asa","","GB"]);
_gaq.push(["_addItem","100000029","12","Test Item","","10.0000","1.0000"]);
_gaq.push(["_trackTrans"]);
//]]></script></div>

One of the advantages of async Google Analytics is that you can put it at the top of the page.
Google recommends putting it at the top of the body, not the bottom. Your intermittent tracking may be due to people leaving the page before the tracking beacon has been sent. This could be fixed by putting the code higher in the page.
http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html#Installation
Your code looks good otherwise. It would be help if you posted the live URL though.

Related

how to check which version of Google Analytic code is working?

I am working on a website, and i want to do record event event on the website. for that i have searched on Google and found Event Tracking. but i how to check whether i am using ga.js or analytic.js and which is better to use and why.
My google Analytic code is:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '[TRACKING_ID]']);
_gaq.push(['_setDomainName',document.domain]);
_gaq.push(['_setAllowLinker',true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
please help me.
Universal Analytics does not use the .push syntax. Instead, it has a function ga().
You apear to not be using universal analtyics you should check this link on how to work with Event Tracking: Event Tracking - Web Tracking (ga.js)
This link should help you understand the diffrence: About Universal Analtyics

Link multiple Google webmaster tools accounts to single Analytics property

I tried to look for a good solution but couldn't find any.
I try to link multiple Google webmaster tools accounts to a single Analytics property.
I tried creating multiple views, but it seems you can't link it to a view.
I found a solution to add multiple domains to a Google Analytics property, but this seems outdated since Universal tracking
Note: probably some people might say I should 301 redirect the domains for duplicate content. But they are regionaly implemented using the hreflang alternate method which should be just fine.
You can link multiple Google Analytics accounts.
<script type="text/javascript">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
// Second tracker
_gaq.push(['secondTracker._setAccount','UA-YYYYYYYY-Y']);
_gaq.push(['secondTracker._trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
See: http://seo-website-designer.com/Google-Analytics-Tracking-Multiple-Accounts

GA - Experiments does not work

we try to set up experiments in our site. We would like to testing 3 type of banner on our home page.
1. If anybody click on the banner, makes event, which si set up as a goal in GA. This goal measure clicking correctly.
2. We implement code for measuring experiments and made javascript function for changing banners, they changing well.
3. For set up whole experiments in GA and in code we follow this documentation: https://developers.google.com/analytics/solutions/experiments-client-side
Finnaly our whole GA script on site looks this:
<script src="//www.google-analytics.com/cx/api.js?experiment=sTe5dJkJTfmSO8YXsc7Kuw">
<script>
var variation = cxApi.chooseVariation();
cxApi.setChosenVariation(variation);
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" src="http://oursite.cz/js/ga.js"></script>
<script type="text/javascript">
_gaq.push(['_trackPageview']);
</script>
Problem is, that experiment does not work. It does not measure anything. When we try to look on console, what data are sending, we realize, that ` correctly send hash Te5dJkJTfmSO8YXsc7Kuw, but that is all, There is no data of variation type, which was choosed by
<script>
var variation = cxApi.chooseVariation();
cxApi.setChosenVariation(variation);
</script>
It should sent 0 or 1 or 2, but it send nothing. What we make wrong? Thank you for answer,
You're missing the closing tag when loading the content experiment.
You have:
<script src="//www.google-analytics.com/cx/api.js?experiment=sTe5dJkJTfmSO8YXsc7Kuw">
Should be:
<script src="//www.google-analytics.com/cx/api.js?experiment=sTe5dJkJTfmSO8YXsc7Kuw"></script>

Google Analytics Ecommerce Tracking - Multiple Accounts

We are using Google Analytics on hundreds of client sites. Each site has its own account, and we also have an account for aggregate data. We're using the following code for tracking pageviews to both accounts.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']); //obviously fake UA numbers
_gaq.push(['_trackPageview']);
_gaq.push(
['aggregate._setAccount', 'UA-87654321-1'],
['aggregate._trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
This is working well for tracking visits & behaviour, but I'm not sure how to implement the same type of double tracking for the ecommerce tracking code. We're using the usual _addTrans, _addItem and _trackTrans setup.
How can I adapt the ecommerce tracking to report to both accounts?
In your code, the aggregate. in the _gaq.push calls like aggregate._setAccount is used to create an additional named tracker.
Just copy the ecommerce _gaq.push code lines, and add aggregate. in front of the _addTrans, _addItem and _trackTrans calls.
For example,
_gaq.push(['_addTrans', ...parameters...]);
_gaq.push(['aggregate._addTrans', ...parameters...]);

Google Analytics reports to be receiving data, but none is showing up

Hi recently redesigned my site (http://bit.ly/gwrYwb) which was formerly tracking pageviews properly via Google Analytics. After the redesign, I inserted the exact same code right before the </head> tag:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
(The UA number is correct on the actual page.) However, GA is mysteriously reporting zero pageviews/visits, even though it claims to be receiving data. Has anyone experienced a problem like this before? The only other JS I'm using is including jQuery, as well as a widely-used jQuery plugin on one of my pages.
This is kind of lame, but have you checked your profile filters? You might still have old filters (for the former website) applied that filter all urls out.
We had this problem with another website and were debugging for weeks until we found this simple solution...

Resources