A number of agencies have tried to address the concerns by signing on to diversity initiatives meant to improve gender and racial representation in ad campaigns and in the workplace, but their attempts have clashed with a workplace culture still fueled by testosterone and booze.

Creative teams are still led overwhelmingly by men, and women make up a third of chief marketing officers, although women and men join the industry in equal numbers, according to the trade groups She Runs It and the Institute of Practitioners in Advertising. The gender pay gap in marketing exceeds the average across other industries, according to Glassdoor.

The ad agency TracyLocke, which has done work for Pepsi and the rum brand Captain Morgan, signaled that it wanted to set itself apart by promoting “Feminist Fridays” on its social media accounts and hiring female illustrators to create portraits of famous women for a series called “Making Herstory.” But according to Karen Dunbar, who spent nearly three years in the Connecticut office as a freelance creative director and copywriter, it remains an uncomfortable place for women.

In a discrimination lawsuit filed against TracyLocke in June, Ms. Dunbar claimed that male colleagues referred to her as a “nagging wife,” suggested taping her mouth shut, threw papers in her face and rubbed her back in view of colleagues. She also accused Hugh Boyle, the company’s chief executive, of encouraging “male managers and subordinates to incorporate” a vulgar term for female genitalia “into their workplace dialogue.” (The suit has yet to be resolved.)