// Function to extract the query parameter function getQueryParam(name) { name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(window.location.href); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } // Function to set a cookie function setCookie(name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + (value || "") + expires + "; path=/"; } // Extract the afrfid parameter from the URL var afrfidValue = getQueryParam('afrfid'); // Set the cookie if afrfidValue is present if(afrfidValue) { setCookie('afrfid_c', afrfidValue, 7); // Set cookie for 7 days }