Election Tracker

Exploring 2020 demographic targeting and attack ads using Facebook’s Ad Library

Facebook’s Ad Library was criticized this week by several sources quoted in The New York Times for being “effectively useless as a way to comprehensively track political advertising.” Those sources – the French government and researchers at Mozilla – point out that the archive is plagued with “bugs and technical issues.”

While that’s true – as we pointed out on Storybench in May – digging into the archive’s API does reveal some interesting insights that illuminate, at least partially, the strategies of 2020 Democratic candidates – and the attack ads being run against them.

Exploring demographic reach

Looking at the age and gender of Facebook users being targeted in the last week by Joe Biden, Elizabeth Warren, Bernie Sanders and Kamala Harris – the four candidates currently leading in the polls – reveals Joe Biden’s strategy to appeal to older voters, previously documented by Vox, and the other candidates’ targeting of 25- to 34-year-olds.

Digging into the content of these ads, we can reveal the tactics and themes being used to appeal to voters.

Counting ads by issue

We found that in almost half of ads targeting Facebook users 55 and older, Biden is asking people to vote on whether or not to “protect Obamacare.” This is of course part of his strategy to make reforms to the Affordable Care Act, which is very relevant to aging Americans, instead of advocating for a Medicare-for-all system supported by the other candidates.

Bernie Sanders, on the other hand, is targeting 25- to 34-year-olds by appealing their concern for the environment. The word “climate” appears in a third of those ads targeted at that demographic and in half of all his Facebook ads in the last week.

DON’T MISS  Quantifying the Twitter attacks on Kamala Harris during and following the Democratic debates

Surfacing attack ads

Using sentiment analysis on the text of the Facebook ads, we surfaced some of the most negative ads mentioning those four 2020 candidates. The Facebook group “WeThePeopleCT,” for example, has been targeting older males with ads attacking Elizabeth Warren for allegedly investing in private prisons, an industry she’s called to eliminate at the federal and state level.

We also surfaced ads attacking Kamala Harris, Joe Biden and Bernie Sanders using sentiment analysis. (Scroll down to bottom of this post for R code we used).

But notice the number of ads supplied by the Ad Library’s API: 547 for Bernie, 125 for Warren, 408 for Biden, 68 for Harris. This is part of the problem critics like Mozilla have been pointing out – without unique IDs or unique URLs, researchers have no idea if this is a comprehensive set of every ad sent by those campaigns.

For now, then, we can only make broad inferences about political strategies using the Ad Library. That’s unfortunate since, if we’ve learned anything from the 2016 election, more transparency is needed.

Sentiment analysis code

tokenized_ads <- biden_warren_bernie_harris_allads %>%
  filter(page_name != "Joe Biden") %>% # filter out ads run by campaigns
  filter(page_name != "Elizabeth Warren") %>%
  filter(page_name != "Bernie Sanders") %>%
  filter(page_name != "Kamala Harris") %>%
  unnest_tokens(word, ad_creative_body) %>%
  inner_join(afinn, by="word") 

sentiment_Bernie <- tokenized_ads %>%
  filter(keyword == "Bernie Sanders") %>% # filter by ads containing candidate name
  group_by(page_name) %>%  # calculate average sentiment of advertiser
  summarise(avgscore = mean(score)) %>% 
  arrange(desc(-avgscore)) %>%

ggplot(sentiment_Bernie, aes(reorder(page_name, avgscore), avgscore)) + # plot all advertisers
  geom_col() +

inspect_NRCC_Bernie_ads <- biden_warren_bernie_harris_allads %>% # inspect negative advertiser
  filter(page_name == "National Republican Congressional Committee") %>% 
Aleszu Bajak
Latest posts by Aleszu Bajak (see all)
DON’T MISS  Measuring Google search interest for 2020 candidates following Fox News appearances

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest from Storybench

Keep up with tutorials, behind-the-scenes interviews and more.