Skip to content

Instantly share code, notes, and snippets.

@cmeza
Last active January 31, 2021 00:15
Show Gist options
  • Save cmeza/cf39c872371b4ec051bd1f2924c53aa1 to your computer and use it in GitHub Desktop.
Save cmeza/cf39c872371b4ec051bd1f2924c53aa1 to your computer and use it in GitHub Desktop.
A simple script to automate the actual turning off of the data FB collects from you via their "partners".

Turn Off Future Tracking of Off-Facebook Activity

This was written to automate the unsetting of all the tracking for these partners. Clicking "Clear History" at the top of this list will only do that, it doesn't turn off FUTURE TRACKING. This script does just that!

The List of Partners

Load this page & paste the JS in the console & hit enter once you see the list of "partners". https://www.facebook.com/off_facebook_activity/activity_list

Manual instructions to get to the right page:

  • log in to FB
  • click drop down arrow top right
  • click 'Settings & Privacy'
  • click 'Settings'
  • click 'Your Facebook Information'
  • click 'View' for 'Off-Facebook Activity'
  • click the circle icons in the first section
  • right click on one of the activities in the list & click 'Inspect'
    (This is important because otherwise the script will not find the elements if they're not visibile for some reason)
  • go to the console & paste the gist, hit enter

Script in Action

I've uploaded a video of me pasting the script in the console & running it & it working. You can see how the list of partners keeps changing.

https://youtu.be/AKhd7s3olgA

(function() {
'use strict';
let waitForFirstClick = 4000;
let activitySelector = 'button._8058._8059';
let turnOffSelector = 'button._7exk._81vn';
let confirmSelector = 'button._271k._271m._1qjd._7tvm._7tv2._7tv4';
let activity = document.querySelector(activitySelector);
activity.click();
/*
The goal would be to loop thru this list of elements:
let activities = document.querySelectorAll(activitySelector);
activities.forEach((activity) => {
activity.click();
...
etc
});
*/
setTimeout(() => {
let turnOffLink = document.querySelector(turnOffSelector);
turnOffLink.click();
setTimeout(() => {
let confirm = Array.from(document.querySelectorAll('div > ' + confirmSelector)).find((element, index) => {
if ( element.offsetParent !== null && element.textContent === 'Turn Off' ) {
//console.log(index, element);
return element;
}
});
confirm.click();
setTimeout(() => {
let close = Array.from(document.querySelectorAll('div > ' + confirmSelector)).find((element, index) => {
if ( element.offsetParent !== null && element.textContent === 'Close' ) {
//console.log(index, element);
return element;
}
});
close.click();
}, 400);
}, 400);
}, waitForFirstClick);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment