Browser extension to clear your Facebook advert interests
At the end of 2018, I wrote a blog post that included some JavaScript code to quickly remove all of your Facebook advert interests from this settings page. This has started to become one of my more popular posts and so I decided to take another pass at the project and convert the code into a browser extension.
The new extension provides the user with an extra button on the ad interests page that will automatically go through and click all of the remove buttons for all of the interest tabs that appear on the top bar. The UI isn’t the best, but it is functional!
You can grab a copy now for 4 major browsers:
- Chrome web store
- Mozilla add-ons
- Opera add-ons (pending review / coming soon)
- Microsoft Edge store
Small improvements
The extension still only works on the English version of Facebook, but now consistently works between different English versions. In the old blog code, there was a problem with translations of Facebook elements having different capitalizations, but that is now taken into account.
A short wait time of 200ms or so has been added between clicks. In the previous version, some users reported that even though some remove buttons were clicked by the script upon reloading some interests would still be listed. I have a feeling, but no proof, that this is down to some rate-limiting done by Facebook.
All visible interest tabs are now cycled through rather than the user needing to run the script once per interest tab, saving everyone a few more moments of life and a few more manual clicks.
Behind the scenes
Code for the extension is on GitHub and should be easy enough to follow.
The logo was created using various parts of various logos from the iconfinder.com iconset called circle-icons-1. Thanks Nick Roach for the GPL licenced icons!
The extension is built using webextension-toolbox which allows easy extension building for Chrome, Firefox, Opera and Edge. I tried using the yeoman generator however npm kept freezing, but I sound the main repo easy enough to work with and remove the parts that I didn’t need.
I plan on using this toolbox to write all future browser extensions and I’m also going to go back and rewrite my previous extensions to use this. The only item that is currently missing as part of the toolbox is automatic zip creation of the builds for uploading to the various web stores.
This is the first extension that I have needed to upload to multiple web stores, and the processes was… not the fastest. Is there some service to do this all for me? If not, should there be one?
[…] 2020 EDIT: This solution is now packaged up as a nice browser extension. Check out this post for more details and links to the browser extension. […]
That’s Great!
I downloaded the extension for chrome, but it doesn’t seem to be working!
What seems to happen / not work? :)
Hey i seem to be in the same boat, the option simply does not appear on the settings page. the extensions is enabled and such.
Hi there!
What’s the URL in the address bar when you visit that settings page?
What language are you looking at Facebook in?
Old or new Facebook layout?
Which browser are you using?
Thanks for the reply.
1. https://www.facebook.com/ds/preferences/ (as you linked)
2. English
3. I was using the new layout, however when you load settings pages it always says “this page has not yet been optimized for the new layout”, so i figured it was the same as the old. However just now i tried opting back out of the layout beta, and the option has appeared.
4. Chrome
I suppose this somewhat solves my issue, though it working on both would be nice. but this does work.
This should be fixed in the latest version!
close your facebook open again and refresh again.Mine appeared not to work either. I did this and then all of a sudden it started deleting them all!
Thank you SO much for this!! You’re a real hero. What about removing all businesses who have either uploaded a list or that you’ve interacted with? I’d pay for this!
Not a bad idea, I’ll try to take a look at that when I next look at the code!
DITTO would pay for this.
It works, sort of. My list of interest categories (bujsiness, tech, hobbies etc) only shows 5 in the horizontal line, then there’s a More… dropdown which shows about 10 more in a dropdown list. If I select one of those and rerun the extension, it doesn’t find those new interests. IE, the extension will only tick the first 5 categories, out of around 15 that I have. So I had to do the others manually.
If you use the extension once, then reload the page, all of the categories should reset and you should be able to run it again with the next set of 5 full categories.
I have the same issue. It removed the first 5 or 6 categories (visible by default in tab) but then as I load more, the button to click “Remove all in….” Doesn’t appear on the page anymore.
Refreshing the page and using the button again should work. I’ll try and either add a note saying that or fix the issue at some point :)
Thanks. That works, but it’s not intuitive right now.
What about similar script for the “Advertisers and Businesses” section just below wher eoyu have to click “Dont Allow” to each company.
I’m also having the same issue of the extension not appearing on https://www.facebook.com/ds/preferences/. From the Chrome dev console, I see “Uncaught TypeError: Cannot read property ‘insertAdjacentHTML’ of null
at Object.2 (facebook-ads-preferences-interests.js:93)”
at webpack_require (facebook-ads-preferences-interests.js:20)
at facebook-ads-preferences-interests.js:84
at facebook-ads-preferences-interests.js:87
It looks like the page is not fully loaded before your script tries to fetch the ID element, so maybe add a line to wait for page load before starting to look for the element?
As a followup, the ID element was only found in the console after I inspected the Interests box. Then I just pasted your code into the console and the button appeared and I was able to clear the interests 🙂 so, thank you!
It looks like this was due to another change in the new Facebook UI.
Version 1.0.5 is now out and being approved by the various browser stores.
It should work with the new Facebook UI :)
Magic!!! But let’s hope it actually makes a difference to the ads, because there was stacks of stuff in my interests I’d never heard of – Facebook just adds what it wants.
Thank you so much for this extension! 🙂
When FB changes their UI design soon, will this continue to work?
I’ll have to check!
Version 1.0.5 is now out and being approved by the various browser stores.
It should work with the new Facebook UI :)
I switched back to the classic Facebook view and the browser extension then appeared. It does not work with the new UI
Version 1.0.5 is now out and being approved by the various browser stores.
It should work with the new Facebook UI :)
It’s not working for me. Both Edge and Chrome are blocking the execution. This is in the console.
This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or “hack” someone’s account, it is a scam and will give them access to your Facebook account.
I’m going to take a look at the extension this evening and see what’s up.
People still report that it works for the OLD Facebook UI, but not the new one (even though I thought I fixed that).
That message that you see in the JS console will appear whenever you load the console on Facebook, even if you have no extensions at all.
Version 1.0.5 is now out and being approved by the various browser stores.
It should work with the new Facebook UI :)
It appears they changed how Ad Preferences are being displayed so the extension doesn’t work. Any plans to adjust to this? Thanks.
I would love to say yes, but right now I don’t have the capacity to try and make that fix (It looks like Facebook made quite a big UI change again).
I completely understand. Thought I’d ask to see if I was missing something from the original implementation.
HI Chad!
I updated the extensions in the various stores today, it should take a few hours to get the update approved.
You want to look for the update to version 1.0.6 or 1.0.7 :)
Hello 🙂 I have 1.07 and I don’t see a button. Where should I look?
So firstly it only works in these languages: en_US, en_GB, de_DE, fr_FR, pt_BR, pt_PT, tr_TR
You need to head to the settings https://www.facebook.com/adpreferences/ad_settings
Then navigate to the interests section (Categories used to reach you >> Interest Categories)
You should find the button at the top there.
If you don’t see the button there something might be wrong and I may need to investigate again!
Keeping up with the facebook changes ends up being quite a challenge.
It indeed looks like Facebook changed again and I need to update the extension……..
I just submitted 1.0.8 to all of the extension stores that should fix this latest issue.
It’ll take a little while for the stores to approve the latest version.
Hello again – I’m running Version 1.0.8 and when I go to https://www.facebook.com/adpreferences/ad_settings -> navigate to the interests section (Categories used to reach you -> Interest Categories) it seems like it spins which eventually gets to “Something isn’t working right. This may be because of a technical error we’re working to fix.” Even with the plug-in disabled Facebook still returns the error. Just a heads-up on in for anybody having that issue.
That’s interesting! Not seen that one before!
Maybe it’s because you have so many interests!!
Hello addshore, as Chad explained before, I’m having the same issue.
I tried to go to the same link (https://www.facebook.com/adpreferences/ad_settings) and follow the steps he wrote, and got me to the same text (“Something isn’t working right. This may be because of a technical error we’re working to fix.”) with en_US and en_GB, I did all of this before installing the plug-in.
So, I installed it, followed the steps, but I’m still experiencing the same problem, and I can’t see the button. I’m running version 1.1.0 on Brave browser.
Greetings!
This sounds super odd, but not related to the extension at all (as it happens while it is disabled)
I know that this page has suffered issues with ad blockers in the past, as it has “ads” in the name.
I’m not sure if this might have something to do with it? Could you try turning off the ad blocker in Brave?
Thanks for your reply.
I tried with all the privacy/ad block options and Brave shields disabled and with a fresh install of Firefox, just in case, and, following the same route as before, I got the same dialog box on both (“Something isn’t working right. This may be because of a technical error we’re working to fix.”)
BUT, today I repeated the same process except for one little change (Categories used to reach you > Other Categories), and as you can see here (https://imgur.com/r0QTr6H), the button appears there. And I turned on the adblock and privacy options on Brave, tried again, and it seems to work, I can see the button.
So, I think that’s the correct route to follow, unlike the steps written in some of the comments above and the screenshots in the extensions store (Categories used to reach you > Interest Categories), but if I’m wrong, correct me please.
I turned off my Adblock Plus – free ad blocker extension in Chrome like Kofasoyo suggested and it appeared on a refresh. When I turned Adblock Plus – free ad blocker back on and refreshed the option was still there. Hopefully will be a one time thing.
I stumbled upon another killer extension that lets you remove the annoying and irrelevant posts from your newsfeed such as game and application spam, ads and sponsored posts. I’ll be using them in conjunction with each other to see how it works. So far so good!
[…] Browser extension to clear your Facebook advert interests (new in 2020) […]