Quantifying the effects of racial prejudice on voting is notoriously problematic. Few people admit bias in surveys. So I used a new tool, Google Insights, which tells researchers how often words are searched in different parts of the United States. And many Americans use Google to find racially charged material. I performed the somewhat unpleasant task of ranking states and media markets in the United States based on the proportion of their Google searches that included the word “nigger(s).” This word was included in roughly the same number of Google searches as terms like “Lakers,” “Daily Show,” “migraine” and “economist.”

A huge proportion of the searches I looked at were for jokes about African-Americans. (I did not include searches that included the word “nigga” because these searches were mostly for rap lyrics.) I used data from 2004 to 2007 because I wanted a measure not directly influenced by feelings toward Mr. Obama. From 2008 onward, “Obama” is a prevalent term in racially charged searches.

Once I figured out which parts of the country had the highest racially charged search rates, I could test whether Mr. Obama underperformed in these areas. I predicted how many votes Mr. Obama should have received based on how many votes John Kerry received in 2004 plus the average gain achieved byother 2008 Democratic Congressional candidates. The results were striking: The higher the racially charged search rate in an area, the worse Mr. Obama did.