Welcome to the age of CEO activism. Gone are the days when executives would shy away from sharing their views on matters that had little to do with their company’s day-to-day activities. But some stances are safer bets than others.
Take LGBT rights. In the wake of recently passed anti-LGBT legislation in North Carolina, several CEOs, including Apple’s aapl Tim Cook, Salesforce’s crm Marc Benioff, Bank of America’s bac Brian Moynihan, and even NASCAR’s Brian France, have made their opposition to the law public.
Consumers seem to be welcoming, or at least open to, such views. A recent working paper by Duke’s Aaron Chatterji and Harvard’s Michael Toffel showed that Tim Cook’s public support for gay rights did not hurt, and probably helped, Apple’s brand.
More from FORTUNE
But chief execs should think twice before jumping atop the nearest soapbox. Starbucks sbux CEO Howard Schultz learned that the hard way in 2015 when he launched the Race Together campaign in the aftermath of the killing of Michael Brown in Ferguson, Mo. Schultz encouraged Starbucks baristas to talk race relations with customers while serving them their morning coffee. That didn’t go down easy. Ultimately, Starbucks dialed back the initiative.
For more on CEO activism, watch this Fortune video:
So why are some issues safe while others draw fierce blowback? Chatterji and Toffel think it comes down to a combination of demographics and tactics: For example, millennials largely support gay rights, and many young workers want their employer to share their values. That makes LGBT rights a natural cause for CEOs to champion—and opens the door for them to lead the way on others.
A version of this article appears in the June 1, 2016 issue of Fortune with the headline “Picking Their Battles.”