Just six months ago, Reddit—whose famous slogan is "The front page of the internet"—was a dangerous place for marketers because of its reputation as a pool of trolling and harassment.

Now, the viral-minded site is trying to flip the narrative and draw in advertisers with new ad targeting and buying technology and an in-house studio that specializes in creating custom content. And heavy-hitter brands including Coca-Cola, eBay and Procter & Gamble have all come on board in recent months.

"What makes Reddit distinct from an advertising perspective are the same qualities that make it distinct in organic spaces," explained Zubair Jandali, vp of sales at Reddit. "We have 70,000 active communities—few places on the web have audiences that are as passionate as ours."

Data backs up Jandali's claim. The publisher's traffic hit 51.4 million monthly users in May, up from 28.4 million a year before, according to comScore.

It's the kind of stat that seemingly flies in the face of accusations that Reddit's audience is too niche—and sometimes too cruel—for brands to take seriously. But the goal is simple: capitalize on the massive momentum around native advertising with a specialized team to create content, much like the in-house agencies that have made big-name publishers including The New York Times, The Atlantic and Vox Media leaders in the space.

Since January, Reddit has hired a team of five creatives to staff an internal agency that works with brands to create ads that fit into subreddits (or Reddit's editorial forums). Meanwhile, its sales staff has grown from nine people to 24 employees, and the engineering and product team has grown from 12 to 30 staffers in the past year.

In March, Reddit poached Google engineer Toby Segaran to build out an ad-tech platform. In his first three months, Segaran has launched programmatic buying and a search-based targeting tool akin to Google's AdWords that lets marketers zero in on chatter surrounding specific keywords. Given the site's volatile nature, there are also some clever workarounds with Reddit's technology that avoid negative chatter altogether in subreddits.

"A brand can say, 'Show me any place where airlines are being discussed except where complaints are also mentioned,'" Jandali explained.

Later this year, Reddit will roll out new analytic and measurement tools for advertisers.

EBay, for one, is a believer in Reddit. The ecommerce brand has run more than a dozen campaigns since October, including one for Star Wars Day in May that promoted products based on the film, like a Darth Vader-shaped ice tray and coffee mugs. Promos at the top of Reddit.com targeted subreddits where people were talking about the film with a link to buy the products. Zeroing in specifically on movie-related chatter increased click-through rates by 35 percent compared to ads that were not targeted.

"Outside of our efforts, Reddit users discuss eBay often and there is a healthy portion of traffic deriving from the Reddit site. Our goal is to augment that in a way that feels natural to Redditors," said Llibert Argerich, eBay's global director of social and content.

Other brands are starting to lean into the content and community itself to subtly shape online conversations. When Coca-Cola wanted to tease its Super Bowl spot starring Marvel superheroes Hulk and Ant-Man in February, it set up a branded post asking consumers which characters they would like to see in the commercial, generating more than 400 comments.

Bachir Zeroual, global director of marketing ventures for Coca-Cola, explained that the brand put paid ads into its efforts because "most Coke campaigns end up on Reddit one way or another." In other words, Zeroual puts marketing dollars behind Reddit to keep chatter positive.

The campaign came together less than a week before the Super Bowl and generated more than 17 million impressions, with the average user spending 13 minutes with the thread. More importantly, 97 percent of the comments were positive and 28 percent of people returned to the content later.

Still, there are plenty of pitfalls in working with Reddit. Similar to how brands have long preferred running ads alongside entertainment or lifestyle content versus breaking or hard news, there's always a chance that Reddit ads will be associated with risky content.

"It's the ultimate in terms of user-generated content," said Sarah Baehr, evp and managing partner of digital investment at Horizon Media. "The fact that they can be more unedited and that there can be areas that can be very controversial is the big challenge in making sure that you don't end up against content that's deemed inappropriate."

At the same time, building an ad business won't happen overnight, said Chris Stemborowski, associate strategy director at Essence, which worked with the site to create branded content for client Google last fall.

"The direction that they're moving in is very much iterative and it's slow paced, but it's because they're balancing this dynamic of the unique community that they have, which has value to advertisers," he noted. "If they just open it up to banners and 'click here' messages, it's going to lose its value proposition for the community that they've built over a decade."

This story first appeared in the June 20, 2016 issue of Adweek magazine.

Click here to subscribe.