Introduction

If you are on Twitter (or any social media to be honest), there is a lot of personal usage data that could be very interesting that you generate by just using their service.

This data is generated based on the tweets you write, retweet, like or share and pretty much anything else you do within their app.

Those Interests allow Twitter to generate a more or less precise targeting profile to better serve their advertising and editorial algorithm. For better (geniune better topics) or worse (excessive ad-tracking).

For the past few years, Twitter has allowed you to view that list of Interests it has collected on you and allows you to remove yourself from topics you don’t like.

You can access this personalized list from this link ; or in the settings menu:

Settings & Privacy > Privacy & Safety > Ad Preferences > Interests.

Here’s an example below:

Twitter interests example

Indeed, this is a feature deeply embedded in the Topic suggestion system offered by Twitter since the end of 2019. These interests slowly help building a profile that is then used to suggest you with Topics to follow.

What does that mean for us?

I don’t know about you, but personally I have different reasons for not having a complete set of my interests generated every time I use a social network. I fight advertisements, tracking and telemetry at home with a dedicated Pi-Hole and browsers extensions: that’s just something else to think about while I keep an active account on those platforms.

The accuracy of these Interests is quite average, with quite a few false positives (or topics that interested me once four years ago… but not anymore). Without being in bad faith, I have to admit that the selected topics correspond globally to what interests me.

Sadly, there is no option today to select and uncheck all the interests in this list in a simple way; and after several years of use, those Interests can number in the hundreds.

What I first (lazily) tried

Initially motivated, I set out to quickly deselect these items one by one, with the help of my amazing accuracy earned from previous FPS experiences: but if you keep an eye on your console (F12 on your web browser), you’ll notice that you’ll get blocked (throttled) by Twitter if you do these actions too quickly.

The site itself does not warn you when you reach this invisible limit. So after 200 or 300 interests unchecked by hand, if you refresh you will notice that only a few dozen have actually been taken into account.

A recommended solution

Good ol’ Javascript script to the rescue

Of course, you know how interesting it is for computer scientists to automate things. So naturally, developing a little piece of code that would click on each element for us, waiting a few seconds between each virtual click, was a sufficient solution.

You can find it on the Gist link or find it below. Courtesy of @padajo.

/*
 * To untick all the "personalised interests" that are used for ad targeting on twitter
 * you go to this page: https://twitter.com/settings/your_twitter_data/twitter_interests 
 * 
 * Go to the inspector and run this code and it should untick all the ticked boxes
 * in the list. You need a delay or the twitter API thinks you're trying to overload it.
 */
var checkboxes = [];
document.querySelectorAll('input[type="checkbox"]').forEach((c) => {
  if(c.checked) { 
    checkboxes[checkboxes.length] = c; 
  }
});
var i = 0;

var loopId = setInterval(() => {
  var e = checkboxes[i++];
  if(i % 10 == 0) { console.log("Running... (" + i + ")")} // Should say on the Console where we're at.
  if(e !== undefined) {
    if(e.checked) {
      console.log(e);
      e.parentElement.click(); 
    }
  } else {
    clearInterval(loopId);
  }
}, 5000); // seems to be a good interval to not overload the API and leave it running in the background.

How to run this script

  1. Connect yourself to your Twitter account and go to the dedicated Twitter Interests page.
  2. From there, press F12 to open Developer Tools (this should work on Firefox, Chrome and most browsers) and then select the Console tab.
  3. Copy and paste the script and run it by pressing Enter.
  4. Let it run, keep an eye on the messages there. You should be set.

The script should go through all these boxes and uncheck them all!

End notes

Reducing delay

You can try setting a quicker delay (like 1000-2000 milliseconds), but you may be temporarily blocked (even though checkboxes continue to be unticked).

You’ll know you’re temporarily blocked when you receive a message like: Twitter is over capacity.... You’ll have to wait a bit and retry again.

Personnally I find 5000 milliseconds between each tick is big enough so it can run in the background without me having worrying about it getting blocked.

Opt-in to suggested Topics

Naturally, you can chose to opt-in and re-select only the Interests you’re into.

Ah sh*t, here we go again

Please note that after a few days, this list of interest rebuilds itself, there is no way to deactivate this f e a t u r e for good at the moment. We’ll have to run this script again!