By sending a message via the contact form, I consent to the processing of my personal data for the purpose of responding to my request. (For more information and revocation notices, please see the Privacy Policy ).
 
function getCookie(name) {
  const match = document.cookie.match(new RegExp('(?:^| )' + name + '=([^;]+)'));
  return match ? decodeURIComponent(match[1]) : null;
}
function updateGoogleAdsConsent() {
  const hiddenField = document.querySelector('input[name="borlabs_cookie"]');
  if (!hiddenField) return;
  const cookieVal = getCookie('borlabs-cookie');
  if (!cookieVal) {
    hiddenField.value = "unknown";
    return;
  }
  try {
    const parsed = JSON.parse(cookieVal);
    const marketing = parsed.consents?.marketing || [];
    if (marketing.includes("google-ads")) {
      hiddenField.value = "granted";
    } else {
      hiddenField.value = "denied";
    }
  } catch (e) {
    console.error("Error parsing Borlabs cookie:", e, cookieVal);
    hiddenField.value = "unknown";
  }
  console.log('[Borlabs] Google Ads consent:', hiddenField.value);
}
// Initial check
document.addEventListener("DOMContentLoaded", updateGoogleAdsConsent);
// Update if the user changes consent later
window.addEventListener('borlabs-cookie-consent-saved', updateGoogleAdsConsent);
window.addEventListener('borlabs-cookie-handle-unblock', updateGoogleAdsConsent);