Getting stuck in rush hour traffic sucks. But if you're in the business of billboard advertising? Standstill traffic is ideal. It's as close to a captive audience as you're gonna get these days.

McDonald's decided to turn bad traffic into an opportunity to commiserate with drivers about the suckiness of the situation -- and hopefully sell some burgers to boot. They used digital billboards and traffic data to make it happen in a nationwide U.K. campaign.

Here's how it all worked.

When traffic flow was normal, the billboards displayed tasty-looking images of McDonald's burgers, fries and shakes. As drivers passed by, delicious McDonald's items would look down upon them. Pretty standard billboard advertising stuff.

 inline image

When the traffic slowed down, the billboards would change to a traffic-related message. Instead of pictures of food, drivers would see the iconic golden arches and a line of copy such as: Stuck in a jam? There's a light at the end of the tunnel."

 inline image

It's almost as if the billboard knew exactly the pain drivers were experiencing. Because they did.

The billboards were programed to deliver different ads depending on the current traffic flow. The nationwide U.K. campaign was created by advertising agency Leo Burnett and produced by Grand Visual, a digital agency that focuses in outdoor advertising. The campaign ran earlier this month in 10 different cities.

The data-driven campaign was designed to capture drivers' attention with "tactical messages that tap into their mindset in that moment," said Katie Parker, McDonald's Head of Marketing, in a press release. It's playful and clever, but at the same time feels a little Big Brother-y.

The billboards may have brought a smile to the faces of grumpy drivers as they inched home after work. On the other hand, the McDonald's campaign may have made people wonder: How does this billboard know I'm stuck in traffic?

It all comes down to the strategic use of data. From fast food giants to Amazon, data is becoming every successful brand's secret weapon.

Since the beginning of advertising time, playing on consumers' emotions has always been effective. Brands that know how to leverage data to tap into how people feel have the upper hand. When they've got the ability to deliver a message that's strategically targeted to how you might feel right here, right now, you just might end up stopping by the McDonald's drive-through on the way home.