Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get 'Storage not available. Aborting hit.' with Google Analytics?

I'm setting up with the new Google Analytics tracking code.

<script>       (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){       (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),       m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)       })(window,document,'script','//www.google-analytics.com/analytics.js','ga');        ga('create', 'MYUACODE', 'MYDOMAIN');       ga('send', 'pageview', {           'page': '/setup',           'title': 'Setup Page'         });      </script> 

I've got this inside my HEAD tag as Google tell you to do Obviously MYUACODE and MYDOMAIN are the real variables in my page :)

However when I run this using Google Chrome and I turn on the Google Analytics Debug extension, I get the following message:

Registered new plugin: "linker"       analytics_debug.js:5 Creating new tracker: t0              analytics_debug.js:5 New visitor. Generating new clientId  analytics_debug.js:5 Storage not available. Aborting hit.  analytics_debug.js:5 

It seems to fire up correctly and starts setting up the items, but then it says Storage not available and it seems nothing ever gets to Google.

Now if I remove all this code and go back to the original Google Tracking code, it works fine, I just can't seem to get this new style to fire correctly.

Any thoughts? Help? Thanks in advance

like image 732
keranm Avatar asked Apr 13 '13 20:04

keranm


People also ask

Why Google Analytics is not working?

Verify that you're tracking the right property and view. If you have access to multiple Google Analytics accounts and properties, there's a chance that you might be using the Google Analytics tracking code from another property, or you may be looking at reports in the wrong account, or for the wrong property and view.

How do I fix my Google Analytics tracking code?

A nonstandard implementation of Google Analytics tracking code on some of the web pages on your website may also trigger the 'invalid tracking code' notification. The best solution for such notification is to ensure that the Google Analytics web property ID in the Google Analytics JavaScript (analytics. js or gtag.

Why I cant open Google Analytics?

Go to options and click "show adds on web or domain", add the the domain https://www.google.com/analytics/ and that should fix it. Show activity on this post. Clear your cache and disable any plugins that might be interfering. This should be the first thing to try!!


2 Answers

I had the same error message. It seems to be related to not being able to set the cookie correctly. In my case, it happened when I was testing off localhost and I hadn't set my cookieDomain to none.

You may want to try something like the following and see if it works. I'm not sure if the method of passing your domain that you have works.

ga('create', 'MYUACODE', {   'cookieDomain': 'none' }); 
like image 82
Alex T Avatar answered Sep 24 '22 06:09

Alex T


Google Analytics used to generate the tracking code with the hostname hard coded in the create method, which could cause this error when testing on a different hostname. Now when GA generates the tracking code it uses

ga('create', 'UA-XXXXXXXX-X', 'auto'); 

which automatically determines the cookieDomain value. Changing the hardcoded hostname to 'auto' in this method call has fixed this issue for me on several sites that had the old tracking code generated.

like image 36
seangrieve Avatar answered Sep 22 '22 06:09

seangrieve