Skip to main content
(function () {
var renderedAndRefreshed = false;
var scriptId = "script-ad-1592927598994-0";
var divId = "div-gpt-ad-1592927598994-0";
function getAdSlot() {
return searchAdFromScriptId(scriptId);
}
function showAndRender() {
if (!window.adsAllowedToLoad || !window.hasGoogleAdsConsent) return;
var thisAdSlot = getAdSlot();
if (!thisAdSlot) return;
var adDiv = document.getElementById(divId);
if (adDiv) adDiv.style.display = "block";
if (!renderedAndRefreshed) {
bmwblogRenderThisAdSlot(thisAdSlot);
renderedAndRefreshed = true;
} else if (typeof googletag !== "undefined" && googletag.cmd) {
googletag.cmd.push(function () {
googletag.pubads().refresh([thisAdSlot.slot]);
});
}
}
function hideAd() {
var adDiv = document.getElementById(divId);
if (adDiv) adDiv.style.display = "none";
}
if (!window.bmwblogAllFetch) {
window.addEventListener("allFetch", function () {
if (window.adsAllowedToLoad && window.hasGoogleAdsConsent) {
showAndRender();
}
}, false);
} else if (window.adsAllowedToLoad && window.hasGoogleAdsConsent) {
showAndRender();
}
window.addEventListener("consentChanged", function () {
showAndRender();
}, false);
window.addEventListener("consentRevoked", function () {
hideAd();
}, false);
})();