Advice to tech companies on diversity: Own the story by Caroline Fairchild @FortuneMagazine October 21, 2014, 7:24 AM EDT E-mail Tweet Facebook Google Plus Linkedin Share icons To all tech companies battling bad press because of a lack of workplace diversity, a piece of advice: Get ahead of the story.After putting his foot in his mouth with a poorly worded comment on stage about women and pay, Microsoft MSFT CEO Satya Nadella is leading a new diversity effort to recruit and retain more women. The initiative will include measures to ensure equal pay, promote more diverse talent from within and train current employees to increase diversity.“It’s been a very humbling and learning experience for me,” Nadella told CNBC on Monday. “I basically took my own approach to how I’ve approached my career and sprung it on half of humanity.”While the push seems sincere, it is tainted by the firestorm Nadella created by telling female employees that they shouldn’t ask for a raise. If he had announced plans to add more women prior to his misstep it would have been taken more seriously. Now, the company has to defend itself against critics who say the diversity efforts are purely a public relations play.Google GOOG provides an interesting case study for staying ahead of the problem. In May, the tech giant was the first to voluntarily release dismal diversity numbers that showed only 30% of its employees worldwide were women. The company continued its proactive push by publicizing a comprehensive diversity plan a couple months later. Meanwhile, Microsoft did not release its diversity data until earlier this month.Yes, industry big wigs agree that Microsoft would not be pushing diversity as aggressively as it is now without Nadella’s latest gaffe. But maybe that’s not a problem. Telle Whitney, CEO and president of the Anita Borg Institute, a California-based nonprofit promoting the recruitment of women in technology, said if it takes a public embarrassment for the CEO to take the issue seriously, “more power to him.” Unlike Twitter CRM CEO Dick Costolo who reacted defensively last year to criticisms of sexism in the tech industry, Nadella is using this latest media rant as a learning opportunity.“The comments that he made about pay show a lack of knowledge about the work that we do,” Whitney added. “What encouraged me is that he took this as a moment to be reflective.”Vivek Wadhwa, who has written extensively about diversity as fellow at Stanford University focused on corporate governance and director of research at Duke University’s entrepreneurship center, is also encouraged by Nadella’s latest campaign. The misstep made him aware of the issues, said Wadhwa. Without it, he may not have taken such a hard look to learn where Microsoft could improve moving forward.“A lot of good came from it,” Wadhwa said. “It also sent another shock to the tech industry so that other CEOs also started becoming aware. Expect that we will see a series of changes at Microsoft over the next year that address the problem.”Yet Nancy McKinstry, CEO of global information services firm Wolters Kluwer, knows first-hand that a reactionary approach to diversity problems is generally ill-advised. Since becoming CEO in 2003, McKinstry has increased the number of women in management positions from 20% to 50% by fostering a diverse environment from her first day on the job.“Women looking to join Wolters Kluwer see the large numbers of women in management and think, ‘I can do that in this organization,” she told Fortune.To subscribe to Caroline Fairchild’s daily newsletter on the world’s most powerful women, go to www.getbroadsheet.com.