Losing Google Analytics Referrals from your HTTPS Site?
If you recently upgraded your site security by adding https to it, you may have noticed that outgoing traffic to other sites is not passing your referral data to their Google Analytics stats. For example, if you operate a travel-related site which features banners for other businesses, then you are most probably using an Ad Management Plugin which will show and rotate your ads.
What happens when your site visitors are referred to another site
Every time a visitor of your site clicks one of the ads, they are redirected to the advertised site. Once this happens the following actions are triggered:
- Your Google Analytics tracks this outbound traffic
- Your visitor’s browser sends your page address as the referrer
- Your client/advertiser target site Google Analytics tracks this visit as a referral from your site
This way, you and your advertiser can match your outbound and their inbound traffic stats.
What if you are using https while your advertiser site is not
Once the source site (your site) uses https, browsers stop sending referral data to the advertiser site unless the target site also uses https. So, even though your outbound traffic to your advertiser site remains the same, the GA report of your client’s site will show a big drop in referrals coming from your site, while its direct traffic should rise by about the same amount.
There are four instances between two sites
Only one of them does not pass the referral data: when a secure site (https) sends visitors to a non-secure site (http).
- https to http: No referral data sent
- http to http: Referral data sent
- http to https: Referral data sent
- https to https: Referral data sent (by default, current browsers send only the domain, not the full page address)
How to fix this: Meta Referrer Tag
The fix is the referrer meta tag, which is now part of the W3C Referrer Policy standard and is supported by all major browsers.
This tag allows your https site to pass referral data (your domain) to your client’s or advertiser’s http website. Older guides used content="always", which is a legacy value that browsers treat as unsafe-url and which sends the full page address. origin sends only your domain, which is enough for referral reports and leaks less about your visitors. You can find more details about the tag syntax on the meta referrer specification.
How to add Meta Referrer Tag to your WordPress Site
As usual, there are two ways to add code to your WordPress site: the manual way and the plugin way.
- Manually: Add the meta referrer tag through your child theme’s functions.php file. Find and edit functions.php, add the following code snippet and save:
//Add Meta Referrer Tag in Header without Plugin function add_meta_tags() { ?> <meta name="referrer" content="origin" /> <?php } add_action('wp_head', 'add_meta_tags'); - Using a Plugin: If you don’t want to edit your theme files, you can use a code snippets plugin such as WPCode (formerly Insert Headers and Footers) and paste the meta tag into its header section. We used to recommend the Add Meta Tags plugin here, but it is no longer developed, so we don’t recommend it anymore.
Need a hand with your WordPress site? Answer four quick questions and see your flat price before you pay. Start here →
This is not a global fix
Sometimes the referral data is still not passed on, for these reasons:
- The tag must be on your site, the one sending the visitors, and it only applies to pages that include it. If a security plugin or your host also sends a Referrer-Policy header, make sure the two don’t conflict.
- Some privacy-focused browsers and extensions trim or remove referrers no matter what the tag says.
They checked out what we thought was the problem and then fixed what was ACTUALLY the problem!
Check your referrer
Click this link from a page on your site to see if your referrer meta tag works.
Image credit: Pablo Garcia Saldaña
Need a hand with your WordPress site?
Answer four quick questions and see your flat price before you pay. Most fixes are done the same day or within 24 business hours.
