Last active
April 16, 2020 01:02
-
-
Save edjw/8f398366bcf98bec09d282b79c030edd to your computer and use it in GitHub Desktop.
A script to remove you from advertisers' FB audience when they uploaded your contact information and it matched the information FB has about you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script removes you from advertisers' target lists on Facebook. | |
// They probably added you to their advert targeting list by uploading a contact list that includes | |
// your contact information like your email address or phone number. | |
// Comment below if this doesn't work for you | |
// *Instructions* | |
// 1. Go to https://www.facebook.com/ads/preferences | |
// 2. Open the Console in the Developer Tools | |
// (Mac: Alt+Cmd+K on Firefox, Alt+Cmd+J on Chrome; Windows/Linux: Control+Shift+K on Firefox, Control+Shift+J on Chrome) | |
// 3. Ignore the warnings from Facebook in the Console. | |
// I've annotated the script to help you understand it but sorry at some point you'll just have to trust me! :-) | |
// 4. Paste in this script below. | |
//////// | |
// This just enforces certain bits of best practice in Javascript (the language this script is written in) | |
"use strict"; | |
// Expands the "Advertisers you've interacted with" dropdown | |
const interactedList = document.getElementsByClassName("_2qo6")[1]; | |
interactedList.click(); | |
// Clicks the "Show more" buttons until all the advertisers are revealed | |
// You may have to adjust the class name for "Show More" buttons if Facebook changes them | |
var showMoreButton = document.getElementsByClassName("_45yq _5946")[0]; | |
while (showMoreButton) { | |
showMoreButton.click(); | |
var showMoreButton = document.getElementsByClassName("_45yq _5946")[0]; | |
} | |
// Clicks into each of the interest areas one-by-one | |
const interests = Array.from(document.getElementsByClassName("_2b2h _2b2i")); | |
interests.forEach((interest) => { | |
interest.click(); | |
// You may have to adjust the class names for "Remove" buttons if Facebook changes them | |
const removeButtons = Array.from(document.getElementsByClassName("_2b2p _4jy0 _4jy3 _517h _51sy _42ft")); | |
// Clicks the remove button on each of the advertisers | |
removeButtons.forEach((removeButton) => { | |
if (removeButton.title == "Hide ads from this advertiser") { | |
removeButton.click(); | |
} | |
if (removeButton.title == "Remove") { | |
removeButton.click(); | |
} | |
}); | |
}); |
Found your script and tried it on my account. Was not working completely. I looked at it for a while and made some tweaks that seem to have made it work for me.
DEL if (removeButton.textContent === "Remove") {
ADD if (removeButton.title == "Hide ads from this advertiser") {
Thanks, I've made those changes now :-)
I updated it to reflect today:
https://gist.github.com/ShoGinn/f29418397e6bc9062d2b0a91169a6bf0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found your script and tried it on my account. Was not working completely. I looked at it for a while and made some tweaks that seem to have made it work for me.
DEL if (removeButton.textContent === "Remove") {
ADD if (removeButton.title == "Hide ads from this advertiser") {