Affiliate links blocked by adblockers

Yes, this is a serious issue. I previously mentioned it in one of the forum threads. Many add-ons, like Ghostery, block links from impact.com, often resulting in an “Access Denied” error or a blank page.

If you’re looking for a workaround, you can try this: check if the following URL is accessible in the background: https://widgets.outbrain.com/outbrain.js. If it’s accessible, it means there’s no adblocker, and you can display the affiliate link. Otherwise, you might need to show the original link.

let isAdBlockerDetected = false; // Initialize the variable
async function detectAdBlock() {
    const out_brain_url = "https://widgets.outbrain.com/outbrain.js";
    try {
        const response = await fetch(new Request(out_brain_url));
        if (!response.ok) {
            isAdBlockerDetected = true;
        }
    } catch (e) {
        isAdBlockerDetected = true; // If an error occurs, assume adblock is detected
    }

    console.log(isAdBlockerDetected ? "Adblocker detected" : "No adblocker detected");
    return isAdBlockerDetected; // You can use this value for further actions
}

1 Like