How to pass Facebook fbclid to Everflow

Recently, I have helped a client with Everflow Offer Tracking with Facebook. He was an affiliate and promoting offers which were available on Everflow Tracking Platform. He was not using any ad tracking software like Voluum or Redtrack. He was using Everflow Facebook Conversion API Integration to pass conversions back to FB. Basically Everflow has two type of tracking i-e Everflow Redirect Tracking & Everflow Direct Tracking. He was using Everflow Redirect Tracking with his Landing page built Funnelish.

Fbclid is unique click identifier which facebook appends with every click. It’s required for FB CAPI (Conversion API) Integration. We have to append the value to our Everflow offer link if we are using redirect tracking. Let’s say our offer url looks like “https://some-everflow-offer.com/partner/offer”. We have to append our fbclid and it should look like this “https://some-everflow-offer.com/partner/offer?fbclid={value_of_fbclid}”.

Lets assume that our landing page url in FB Ad is “https://my-awesome-landing-page.com”. Facebook will automatically append fbclid when users clicks on our ad. We need to read fbclid value and need to append to our Everflow Offer link. I have written below little javascript code which will do this for us.

<script>
function getParameterByName(name) {
    var url = window.location.href;
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

var fbclid = getParameterByName('fbclid');
var anchors = document.getElementsByTagName("a");

for (var i = 0; i < anchors.length; i++) {    
    var base_aff_url = anchors[i].href;
    var aff_url = base_aff_url + (base_aff_url.match(/[\?]/g) ? '&' : '?') + 'fbclid=' +fbclid;
    console.log("FBCLID URL: ", aff_url)
    anchors[i].href= aff_url;
}
</script>

Please append this code to your landing page just before “</body>” tag on your landing page. The code reads fbclid value from current url and update all <a> tags on your landing page. If you are using button or some other tag to link, this code might not work properly. You need to make changes accordingly.

Leave a Comment

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