Blog

HTTPS to HTTP, how to recover the lost Google Analytics Referral Data

Loosing Google Analytics Referrals from your HTTPS Site?

If you recently upgraded your site security by adding https to it you will probably have noticed that any 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 to other business then you will most probably be 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 selects one of the ads he/she is redirected to the advertised site. Once this happens the following actions are triggered:

  1. Your Google Analytics track this outbound traffic
  2. Your visitor browser
  3. Your client/advertiser target site Google Analytics tracks this visit as a referral from your site

This way you and your advertiser will possibly match their outbound and inbound in-between traffic stats.

What if your are using https while your advertiser site is not

Once the source site(your site) adds the https protocol then Google Analytics will stop transferring referral data to the advertiser site unless target site is also using an https protocol as well.
So, even though your outbound traffic to your advertiser site will remain the same the GA report of your client site will show a significant decrease to referrals coming from your site while its direct traffic stats should increase to the same numbers as the lost referral data.

There are four instances between two sites

Only one of them is not passing the referral data; when a secure site(https) is passing data 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

How to fix this: Meta Referrer Tag

Google has foreseen this issue years ago, in 2012 they added Meta Referral Tag for browsers with the appropriate support.

<meta name="referrer" content="always" />

This tag allows your https site referral data to be passed to your client/advertiser http website.
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 most of the times there are two ways adding some code to your WordPress site, the manual way(some call it as the hard way) and the plugin way.

  • Manually: Meta Tags and more specifically Meta Referrer Tag should be added to your theme or child theme functions.php file. Find and edit functions.php, add the following code snippet and finally save:
    //Add Meta Referrer Tag in Header without Plugin
     
    function add_meta_tags() {
    ?>
    	<meta name="referrer" content="always"/>
    <?php }
    add_action('wp_head', 'add_meta_tags');
     
    //Add Meta Referrer Tag in Header without Plugin
  • Using a Plugin: If you don't want to get down and dirty by editing your theme files you can use the Add Meta Tags Plugin instead. You can follow this guide for installing and setting up the Add Meta Tags Plugin.
    Warning: This plugin is no longer developed, original developer no longer recommend using it in production.

This is not a global fix

Meaning that sometime the referral data is still not forwarded since it depends on the following:

  1. Meta Referrer Tag should be added to the target site so there is a big possibility you won't have access to it. If this is the case its time to use your social and trainning skils and convince your client/advertiser to add the tag.
  2. Not all browsers support Meta Referrer Tag.

Check your referrer

Click this link and how see if my referrer meta tag works.

Image credit: Pablo Garcia Saldaña

Makis Mourelatos

WC Athens 2016 co-organizer, WP Support and Security Aficionado, Wannabe Kitesurfer.

View Comments

Share
Published by
Makis Mourelatos

Recent Posts

WordPress Theme Development

WordPress is a widely popular Content Management System (CMS) that powers over 40% of all…

2 years ago

WordPress Solutions

WordPress is a popular platform that empowers more than 60 million websites worldwide. Millions of…

2 years ago

WordPress Site Maintenance

In this article, we will cover ten crucial WordPress site maintenance tasks that every website…

2 years ago

WordPress Security Solutions

In this blog article, we will explore the various WordPress security solutions you can implement…

2 years ago

WordPress Plugin Solutions

Plugins are an integral part of WordPress, as they offer countless benefits and features that…

2 years ago

WordPress Optimization and Performance Improvement

In this article, we will explore various strategies that can help you enhance your WordPress…

2 years ago