Script to remove all ad preferences on facebook
- Log into Facebook on Google Chrome on a desktop
- Go to Settings - > Ads -> Ads Based on my preferences -> Manage preferences
- On the preferences page, expand all the categories. I was unable to automate this.
- Press F12 on a Windows or Cmd+Shift+I on a Mac
- This opens the developer console. On the top, you'll find a console tab. Click that
- You'll see a STOP warning from Facebook here. Ignore that, we are just automating what you'd otherwise have to do by clicking about 350 times (Check out
fbapr.js
for code comments and reading the code so that you understand the security of this script you'll be running.) - Copy paste the code from the
fbapr-min.js
file into the console tab. - Sit back and watch hundreds of ad categories being removed!
- Loads jQuery into the console
- Finds all "Show more" buttons and clicks them
- Waits a little while(15 secs) for all the categories to load
- Clicks the "X" button next to all the preferences
- Occasionally, FB will update their div/button classes, so you'll need to update the script variables to point at the correct class id's. Screenshots below on what each variable represents.