I released a new version of my website today and with the old version, I was around 90 visitors an hour, and after the update, it dropped to around 20 visitors.
I don't know what went wrong. Here's the stats:
As you can see, a drop occurred between 3pm and 4pm and drop to finally get to 0 since then.
I added an httpS connection, but the non www and http all redirects to https://www automatically. The tracker is the same, I only added
ga('set', 'forceSSL', true);
ga('set', 'appVersion', '2');
ga('send', 'pageview');
There is only one page (it's a basic app), so there is no other page that could have the tracker removed.
Now, I'm wondering something, when I start the tracker, I send this info :
ga('create', 'UA-XXXXX-X', 'voilanorbert.com');
shouldn't it be ga('create', 'UA-XXXXX-X', 'www.voilanorbert.com');? (with "www.") Is this the issue?
Big Update: I decided to create a new tracker in Google to see if this was a reason, and yes it is! A few minutes after I changed it to the new tracker, the data went to 1 visitors per hour, to 18 in real time! There is clearly a problem in Google Analytics!
Your tracking code was flawed. This does not imply Google Analytics does not work.
The appVersion parameter is reserved for mobile apps and not for the web collection API.
forceSSL is kind of obsolete now
When in doubt, stick to the regular tracking code or use Google Tag Manager.
Related
I am implementing google analytics for the first time. Here are the steps I took.
I went to analytics.google.com and created an account. Then I created a "property". After that I created a "Data Stream" for my website and got a "Measurement ID which starts with a G-XXXXXXX. Then I implemented the following code in the header (before any other css or js calls)
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'G-XXXXXXX', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
When I look at the network tab, I can see that the call was made:
Request URL: https://www.google-analytics.com/j/collect?v=1&_v=j96&a=316116739&t=pageview&_s=1&dl=https://mywebsite.com&ul=en-gb&de=UTF-8&dt=My Website Title&sd=24-bit&sr=1920x1080&vp=1920x577&je=0&_u=ABC~&jid=1234&gjid=1234&cid=1234.1234&tid=G-XXXXXXX&_gid=1234.1234&_r=1&_slc=1&z=1234
Method: Post
Status Code: 200
However when I look at google analytics, it says "Data collection isn't active for your website".
I waited 24 hours to ensure it is not some delay problem but there is still no data and there have been visitors on the website, at the very least myself.
Is there a step I missed or maybe it could be a configuration issue? I haven't been able to find any clues as to why it might not be working. Any help is most appreciated.
Note: The values above in Request URL have been modified to remove any sensitive information. All the parameters are there, just values have been changed to ABC and 1234 as its not necessary to see those.
If you want to track with GA4 (G-xxxxxxxx)
You need to use gtag.js for it.
ga.js is not support for GA4
Here is the document
i have a website with GA, i set it up according to a tutorial from their site, basically its the copy paste code, but i added another account
Ga('create','xxxx-1','auto');
Ga('create','yyyy-2','auto', 'acc2');
Ga('send', 'pageview');
Ga('acc2.send', 'pageview');
In the network i sometimes see a http AND a https^a request and sometimes only a http^b or https^c.
I.e.
scenario a i get 4 requests, 2 for each account
Scenario b i get 2 requests, 1 for each ( this looks nirmal to me)
Scenario c i get 2 requests again but from https (i again this looks
normal to me)
So overall in 3 questions:
Is this normal? Why is it not consistent and always send one way.
Does http and https result in double counting??
Should ut send only from one? Http OR https?
Thanks in advance!
The first thing I'd do is to install Google Analytics through Google tag manager. GTM allows a much better control over the firing rules (ie: you can set it to fire only when the dom is fully loaded for example).
Then, I'd recommend to install the add-on 'Google Analytics debugger' for chrome (made by Google: https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en). It will show you exactly what is sent to GA in the console and also highlight any problem with your configuration.
Finally, if your website support https you should not see page-views with 'http://' in GA. That could potentially mean that the https DNS redirect is not configured properly.
If you give me the URL of your site I am happy to have a look for you.
Best,
A.
I'm trying to introduce Google Analytics in a sort of desktop app that all loading files are done through file:// not http or localhost (because most of the time it works offline). Any attempt to track app uses with Google Analytics or Google Tag Manager wasn't work.
For example, I've used:
ga('create', 'UA-XXXXX-Y', 'auto');
ga('set', 'checkProtocolTask', null);
ga('set', 'checkStorageTask', null);
ga('send', 'pageview');
As explained here (adding ga('set', 'checkStorageTask', null);
) with no results.
Has anybody deal with this situation?
I run a very quick test. ga('set', 'checkStorageTask', null); did nothing for me, instead I found it necessary to set storage to none on tracker creation (which makes sense, since you cannot set cookies with the file protocol). This also means that you probably won't have session tracking, since each hit generates a new ID.
ga('set', 'checkProtocolTask', null) seems necessary - else the debugger complains (naturally) that file is not a valid protocol.
After that data was sucessfully sent, but did not show up in the realtime view. I suspected that maybe the reporting engine does not like the file protocol and set the "location" field with a correct protocol. So I ended up with:
ga('create', 'UA-XXXXXX-5' , {'storage':'none'});
ga('set', 'checkProtocolTask', null);
ga('send', 'pageview' , {'location' : document.location.href.replace('file','http') });
and that displayed in the realtime reports. This was a real quick test, so you need to verify this independently. Notice that you do not need to set a cookie domain (the "auto" argument in your code example) since you cannot set a cookie in any case (there is no domain to set the cookie to).
Also if you work offline for most of the time GA will not work (you need to load the analytics.js file and you need sent calls to the tracking server), but then you are probably aware of that.
I have added the Google Dynamic Re Marketing Tag to my website by use of my GTM account (test#gmail.com) successfully; it was shown with minor warnings in Google Tag Assistant as well. But, when I later switched to another GTM account (original#gmail.com) with the same settings it shows an error: “No HTTP response detected”. How this can happen when both the GTM accounts have the same data ? Any help appreciated.
Thanks!
This means clearly the code is not getting executed, could be syntax error, or extra parameters...etc. In my scenario I was sending transaction as part of Ecommerce,
(ref : https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce )
ga('require', 'ec', 'commerce.js'); ///HTTP RESPONSE NOT DETECTED..error.
ga('require', 'ec'); ///SOLVED THE ISSUE
so on similar grounds, check the syntax!
I've been noticing this error on Chrome's console for a while now:
I modified Google's script so that it logs the error, because it uses try{} catch{}, and this is what I got:
I haven't noticed considerable changes in the stats, it's always in ups and downs.
Also, this isn't only on my sites, but fricking everywhere. I haven't found bug reports or anything like that.
If I go to http://www.google-analytics.com/ga.js on the browser, it loads normally.
Does anyone have a clue of what causes this?
It was a problem with AdBlock. I disabled it and now it loads it normally.
yagudaev suggests (read answers below) that in order to keep AdBlock from blocking Google Analytics, you need to edit the snippet provided and explicitly use https:// instead of the protocol-relative URL by default. This means changing
'//www.google-analytics.com/analytics.js'
into
'https://www.google-analytics.com/analytics.js'
Example:
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-XX', 'auto');
ga('send', 'pageview');
</script>
It could also be your hosts file, here's mine:
$ grep -ni "google-analytics.com" /etc/hosts
6203:# 127.0.0.1 ssl.google-analytics.com #[disabled = Firefox issues]
6204:127.0.0.1 www.google-analytics.com #[Google Analytics]
If it's an offline app (ie, you've defined a cache manifest) be sure to allow the network request.
See HTML5 Appcache causing problems with Google Analytics
The reason you are running into problems is because AdBlock will block this script if and only if it does not go through https. Notice the error you get it contains an http: protocol reference.
All you need to do is change the snippet to force it to go through an ssl connection by adding an explicit protocol instead of the protocol relative url that is the default.
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-XX', 'auto');
ga('send', 'pageview');
</script>
This error is commonly caused due to one of the extensions installed within Chrome.
There are a few ways to debug and solve an ERR_BLOCKED_BY_CLIENT message.
Disable the extension.
Whitelist the domain.
Debug the issue.
I would recommend to find more detail at How to Solve ERR_BLOCKED_BY_CLIENT
2019 update
This has become very widespread now.
Solutions
Ask people to unblock your website, (bad idea from personal experience)
Host google analytics script locally (bad idea) because google says so HERE
Referencing the JavaScript file from Google's servers (i.e.,
https://www.googletagmanager.com/gtag/js) ensures that you get access
to new features and product updates as they become available, giving
you the most accurate data in your reports.
Use Server side analytics. This is what people are doing nowadays. If you are on node.js, use a library such as analytics or universal-analytics
I've noticed same thing on my browser some time ago.
Did you sing in to chrome using your Google account maybe? Or did you choose in any way to opt-out from collecting data on Google Analytics ?
Maybe Google remembers that option and uses it on Chrome when you are singed in..
BTW. I can normally open http://www.google-analytics.com/ga.js in browser, it just doesn't work when automatically loaded.
Ensure Fiddler (or similar proxy) is not active.