Skip to content

Instantly share code, notes, and snippets.

@atomicbird
Forked from scarlac/purge_advertisers.md
Last active July 18, 2019 15:44
Show Gist options
  • Save atomicbird/6608853fc87f26d5b687e10829c67541 to your computer and use it in GitHub Desktop.
Save atomicbird/6608853fc87f26d5b687e10829c67541 to your computer and use it in GitHub Desktop.
Facebook Hack: Purge list of "Advertisers you've interacted with"

For those of you who want to remove all in “Advertisers you’ve interacted with”:

  1. Go to https://www.facebook.com/ads/preferences/?entry_product=ad_settings_screen and open the section "Advertisers you've interacted with"
  2. Open Web Inspector
  3. Copy-paste this script to load all advertisers: smt=setInterval(() => {let x=document.querySelector('div[shade=medium]'); x ? x.click() : clearInterval(smt), console.log('done')}, 1000)
  4. It will output a number. Wait for it to say “done” in the console. This may take a long time. you'll notice the scrollbar changing while it's loading all advertisers.
  5. Copy-paste this and press enter: document.querySelectorAll('[data-tooltip-content="Hide all ads from this advertiser"]').forEach(el => el.click()). Note Facebook has changed the text on the button a few times, so if this has no effect, you may need to edit the command. Hover over the "x" icon on any advertiser until a pop-up tooltip appears. Make the double-quoted text in this command match the tooltip text. For example this text used to read "Hide ads from this advertiser", and before that it read simply "Remove".
  6. Wait for advertisers to turn grey, indicating they've been removed (this may take a while as well)

That's it.

@atomicbird
Copy link
Author

As of today it looks like the page has changed slightly. Step 5 should now read document.querySelectorAll('[data-tooltip-content="Hide ads from this advertiser"]').forEach(el => el.click()).

@atomicbird
Copy link
Author

Update, Facebook has apparently removed the ability to block advertisers, so this doesn't work any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment