html advert issues

Hi everyone,

So before I updated to the Wix code beta I’ve been displaying affiliate adverts in the html box app that comes with the editor. The problem with displaying ads like this, is that if someone has an ad blocker turned on then the ad disappears and leaves a space where the ad should have been. I want to know if it’s possible for the gap to be filled in by the elements below when someone is using an ad blocker, like the majority of websites do. If you check out my website here - www.thedailypush.com you can see what I mean with the advert at the bottom of the homepage.

Thanks in advance for the help!

The only solution I would think of is putting the ads inside an iframe and use the postMessage to the iframe to fill it with the ads code and if someone uses a ad blocker the iframe would be empty and you might be able to check that with the recieveMessage in that scenario. Look at the samples for charts in the sampes section for more info about this technique.

1 Like

Hey,

The code inside the HTML component will need to determine whether the site visitor has an Ad Blocker chrome extension. If so, the HTML component should send a message to the page code. Afterwards, your page code can collapse the HTML component.

Please review the Messaging section of this article.

Best,
Tal.

1 Like

Hi guys thanks a lot for your responses! The thing is, I literally have 0% knowledge when it comes to HTML and coding. Which one of those options would be the easiest and would you be able to give me a bit of a step by step guide?

Thanks! I really appreciate the help.
Matt

Hey Matt,

I would start by searching on Google how to detect whether a site visitor has Adblocker or not:
https://ctrlq.org/code/19818-detect-adblock-javascript

Regards,
Tal.