TAKING your hat off at the door may seem like a throwback to a more genteel age. But the practice lives on at modern sporting events. Dutch buyers of Heineken beer were given green hats to wear to the recent Euro 2008 football tournament. Anyone who tried to enter a stadium wearing one, however, as many fans did in 2004, was asked to remove it. The hats were an “ambush marketing” campaign, in which companies try to promote their brands at sporting events without paying sponsorship fees. Heineken's rival, Carlsberg, was an official sponsor of Euro 2008, paying $21m for the privilege. A few TV close-ups of fans wearing Heineken hats would have cost very little by comparison. This was just one of 18 examples of ambush marketing at Euro 2008 identified by researchers at Coventry University Business School.

Ambush marketers have replaced hooligans as the villains of sporting events, because they undermine official sponsors, which are the main source of revenue in some sports. The stakes are highest at the Olympics. This year 12 firms, including Coca-Cola, Samsung and Visa, have paid a total of $866m to be official sponsors of the Beijing Olympics—and they want exclusivity.

The Chinese authorities have responded with their usual subtlety. Between July 11th and September 17th the Beijing Organising Committee for the Olympic games will take control of all prominent advertising sites in the Chinese capital, including those at train stations and airports, and their use will be limited to official sponsors only. (In 1996, when the Olympics were staged in Atlanta, the city was plastered with ads by Nike, which was not a sponsor.) Athletes will be banned from taking their own drinks into the Olympic Village to “protect sponsors' rights”. And at each event if any spectators manage to get past the officials with unofficial food, drinks or clothing, broadcasters will be obliged to avoid showing them in close-up.

But preventing ambushes is difficult. Marketers tend to launch ambush campaigns only once an event has started, making pre-emptive strikes almost impossible. And policing the brand use of individual spectators at the stadium is tricky. Coca-Cola, which has sponsored every Olympiad since 1928, says sponsorship provides “a way to connect with people around the world at a very personal, emotional level”. But if that means depriving spectators of their half-finished Pepsi as they enter a stadium, the emotions may not be happy ones.

Overzealous enforcement can also result in bad press—as with the orange plastic Lederhosen given out by Bavaria, a Dutch brewery, to Dutch fans before a match at the 2006 football World Cup. Officials asked fans to remove the offending garments, to placate Budweiser, a rival beer brand that was the tournament's official sponsor. Many fans ended up watching the match in their underwear, and the resulting fuss generated even more publicity for Bavaria.