Insights

Why Am I Seeing 307 Redirects on My Google Analytics Collect Hits?

Written by Luka Cempre | Apr 3, 2016 6:00:00 AM
We have had quite a few inquiries about duplicated or redirected Google Analytics hits when observed in the network tab of browser's developer tools. Here is a brief explanation on why this happens.

The Issue

Anyone who visits a website that uses Google Analytics will trigger pageviews and events that are sent to Google Analytics. These data points are sent to Google Analytics via a google-analytics.com/collect HTTP request. We have seen an increase in complaints from developers who monitor the sites performance and are alarmed to see potential duplication of these hits. Below is the page's network table that shows what they are seeing. It looks like every collect hit sent via a "GET" method is being duplicated. [caption id="attachment_31613" align="alignnone" width="300"] Google Analytics http requests are redirected and then sent via https protocol.[/caption]

What's really happening?

If you are seeing something similar on your website, don't be afraid. HTTP requests with a status code 307 are not sent to Google Analytics and only serve as redirects, meaning that your hits are not double counted. Generally the redirect happens when these collect hits are not sent through to Google Analytics via SSL protocol. You will notice this by comparing the Request URLs of hits (http vs http s). Request URL of a redirected event hit (http): Request URL of an event hit that actually went through to Google Analytics (https) The most likely cause for this are ad blocking and similar extensions that make sure that your Google Analytics hits are sent via a secure layer. To get to the real cause of the issue you must examine your hits further. Debugging in Google Chrome In Google Chrome navigate to "chrome://net-internals/#events", then open the website where you are seeing collect hits being redirected. In our case we noticed that "Adblock Plus" extension is "hijacking" all google-analytics hits sent through http protocol and redirecting them to a safer https protocol.  

How to resolve it?

The extra collect hits are not causing any errors in tracking. In order to avoid seeing double collect hits you should disable the extensions that are causing or make sure that all your Google Analytics tracking hits are sent securely through HTTPS protocol.

How to send Google Analytics hits via SSL

To send your collect hits via SSL in the first place use the following settings. In GTM: Add "forceSSL" parameter with value "true" in fields to set for UA tags. In Universal Analytics: Set forceSSL for your ga tracker ga('set', 'forceSSL', true).