// Function to get URL parameters
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
let regex = new RegExp('[\\?&]' + name + '=([^]*)');
let results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
// Wait for the page to fully load
$w.onReady(function () {
// Capture the gclid parameter and assign it to the hidden field
$w('#gclid').value = getUrlParameter('gclid');
});