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

Posted on August 20, 2016 at 1:39 am

Tags: ,

3 Comments

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

Comments (3)

  1. AppMarsh Reply

    August 23, 2017 at 9:12 am

    Thank for sharing, where can i find function.php file ?

    1. Makis Mourelatos Reply

      August 23, 2017 at 9:31 am

      It can be found in side your active theme directory under /wp-content/themes/

  2. Gauco Reply

    September 17, 2017 at 8:24 pm

    Many thanks for this information with the Metatag

Leave a Reply

Your email address will not be published. Required fields are marked *