Script to Remove "Promoted Tweets" (Ads) from Timeline

Ads, which Twitter euphemistically refers to as "promoted tweets," have been running on the Twitter site in the right side bar and at the top of search results for some time.

6450048379_bb933c9da1_b

But yesterday was the first time I encountered a "promoted tweet" in my timeline. Yesterday was the first time sponsors trespassed onto the Twitter space I get to curate. The first time a visitor was on my virtual property without my permission.

There have been kerfuffles in the past. Remember when Twitter moved to the re-tweet format that preserves the avatars of the originating Tweeter? In that case, one had to get used to unfamiliar icons showing up in the stream, let in, as it were, by followers who let themselves into your kitchen and forgot to close the screendoor behind them. With the new re-tweet format, Twitter was in effect insisting you give junior curation privileges to anyone you follow. The move may have had the effect of upping the criteria for following; but because tweets and worthy twitterers were proliferating, that was okay.

6449988321_a821fd4208_bAds in the tweetstream are altogether different. Those items are not from friends of friends, not by any stretch.

Well, I was visiting my eldest son, Dan Carleton, last night, and asked him if there was a way to get rid of the damn ads. Sure, he said. He got out a laptop and wrote a script as a present for my 50th birthday. Tossed it off in under an hour. Here it is.

When asked by Dan to reproduce the frustration, I couldn't actually find the original offending ad. It had disappeared from my timeline. That made sense to Dan. He said: "It's not really a tweet. It's an ad." Such an item didn't have a legitimate place in your stream in the first place, wouldn't be something you would want to go back to. And besides, as Dan said, "they want to place the ads near the top of your stream."

The photos show Dan's work, testing his code against a promoted tweet in a search result. In the second photo, you can see a blank space where the ad has been removed. In his next step, Dan tightened things up so that the blank space disappears as well, so tweets should stack normally. If you use his script, you probably will see, on search queries, a promoted tweet appear briefly (fraction of a second) and then disappear.

Here's how Dan describes the script on userscripts.org:

"Script Summary: Hides promoted items from Twitter streams. Was only able to test with the stream from a sponsered hash tag, because promoted items in timelines are elusive. Technical: Sets style "display: none" on the parent of divs with classes promoted-tweet and stream-item-content, onload and every two seconds."

I don't fully understand that but many of you do.


blog comments powered by Disqus