It's a blog

Browser extension to clear your Facebook advert interests

Extension logo

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:

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?

Increase in views of the origional blog post

30 Comments

  1. BarqFarooq

    That’s Great!

  2. Sarah Reuer

    I downloaded the extension for chrome, but it doesn’t seem to be working!

    • addshore

      What seems to happen / not work? :)

      • Jordan

        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.

        • addshore

          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?

          • Jordan

            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.

          • addshore

            This should be fixed in the latest version!

    • Deb

      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!

  3. Diesel

    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!

    • addshore

      Not a bad idea, I’ll try to take a look at that when I next look at the code!

    • tg

      DITTO would pay for this.

  4. Ron Schifron

    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.

    • addshore

      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.

    • Neeraj Rohilla

      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.

      • addshore

        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 :)

        • Robert Schifreen

          Thanks. That works, but it’s not intuitive right now.

  5. FB Ads

    What about similar script for the “Advertisers and Businesses” section just below wher eoyu have to click “Dont Allow” to each company.

  6. em

    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?

  7. em

    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!

    • addshore

      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 :)

  8. Deb

    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.

  9. Mr. Brightside

    Thank you so much for this extension! 🙂

  10. mjleo

    When FB changes their UI design soon, will this continue to work?

    • addshore

      I’ll have to check!

    • addshore

      Version 1.0.5 is now out and being approved by the various browser stores.
      It should work with the new Facebook UI :)

  11. Edward Clark

    I switched back to the classic Facebook view and the browser extension then appeared. It does not work with the new UI

    • addshore

      Version 1.0.5 is now out and being approved by the various browser stores.
      It should work with the new Facebook UI :)

  12. troy

    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.

    • addshore

      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.

      • addshore

        Version 1.0.5 is now out and being approved by the various browser stores.
        It should work with the new Facebook UI :)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2020 Addshore

Theme by Anders NorénUp ↑

%d bloggers like this: