RockYou has agreed to buy mobile ad network PlayHaven from its parent company, Science.

The deal shows RockYou’s unique position as both an operator of social games and a big advertising network. The acquisition of PlayHaven, which has bounced around a bit, shows how RockYou is accelerating its push into mobile gaming and transforming itself into a new kind of business, as much about advertising and media as it is about gaming.

San Francisco-based RockYou is amid a years-long turnaround led by chief executive Lisa Marino, who is speaking on stage at our GamesBeat Summit this week.

“This is very strategic for the company, as we got very big in online and in 2015 we are making a very big push into mobile,” Marino said in an interview with GamesBeat before the speech. “Our acquisition pipeline for 2015 is exclusively mobile.”

That said, RockYou still does a lot of business making money from advertising and other monetization from social games on the web.

“Our goal is to repeat what we did in the online world with mobile,” Marino said. “We didn’t have the tech or publisher relationships to start that from scratch. This is a big catalyst and game changer for us.”

PlayHaven started as a gamer’s social network, MyGameMug, in 2008. It pivoted a few times and found a niche in mobile game marketing under the leadership of chief executive Andy Yang. Then in March 2014, PlayHaven and analytics firm Kontagent merged to form Upsight. By September 2014, Upsight sold off its PlayHaven ad network to digital marketer Science.

And now the PlayHaven ad network will find a home at RockYou, which is already ranked as one of the top 100 video properties on the Web, according to market researcher ComScore. PlayHaven became available because Science saw that the mobile ad network would prosper more under a company that owned and operated its own games and other media.

“We have become a preeminent aggregator of audiences around the world,” said Marino. “PlayHaven is a great foundation for us to build on, and for our mobile games like Kitchen Scramble and Words of Wonder, as well as future games we’ll announce soon. We also look forward to connecting PlayHaven’s network to our private market of video ads from Fortune 1000 companies.”

She added, “We continue to buy intellectual property that is new to us and leverage our audiences. Gamers are the most engaged users in mobile, but we are also actively looking at apps beyond games that are what I would call ‘daily habit’ apps, or those you go to every day.”

PlayHaven current serves ads for more than 18,000 games with 250 million monthly active users. PlayHaven monitors more than 5.7 billion sessions a month.

“Lisa and her team have developed a brilliant model for sustaining and monetizing great on-demand interactive content across multiple platforms,” said Science CEO Mike Jones. “I’m confident they’ll be as successful on mobile as they already are on Facebook and the Web.”

The terms of the acquisition were not disclosed. But it’s going to make a big impact on RockYou’s business. Marino said that 15 percent of the company’s business prior to the acquisition came from mobile. And by the time the company integrates PlayHaven into its business, that should rise to 30 percent.

RockYou still has a big footing in games. In the past couple of years, the company acquired social games from Disney (Kitchen Scramble, Words of Wonder, City Girl, and Gardens of Time) and Kabam (the Facebook and Web versions of Kingdoms of Camelot and Dragons of Atlantis). It makes money from these by running in-game ads to the players. The company reaches more than 80 million consumers on mobile, Facebook, and the Web.

RockYou recently raised $23 million in funding from Columbia Capital as part of its strategy of operating aging social games at a profit. That money will be used to acquire new games to operate.

In the past couple of years, RockYou has transformed itself by figuring out how to operate aging games that are past their peak. It acquired the games from other publishers who found that they could no longer operate them profitably and needed the teams to move onto other more lucrative opportunities.

RockYou’s own games were duds, at least in term of monetization. So the company decided to move to acquiring other companies’ games. It bought its first titles from Hands-On Mobile, and RockYou learned how to operate them based on the “long tail” audience, or the small group of players who continued to play the games for eyars.

During this process, RockYou had to get recapitalized in 2012. Marino said that there were times when RockYou was on the border of going out of business in mid-2013. But now it is targeting to do $100 million to $200 million in revenue in 2015, thanks to the new business.

“A level of ingenuity got us through some very tough times,” Marino said.

The company stayed strong in advertising, and that was one of the reasons why she stayed at the company during those tough times. She also had an “unhealthy sense of duty that came from the mom in me.” She felt responsible for the company and the 60 employees who were left when the company hit its bottom.

“All you can do is take that punch and figure out what comes next,” Marino said.

One of the rules: “Do it to yourself before it gets done to you,” she said.

Everybody started counting RockYou out.

“Everybody had totally written us off, but that freed us. We could do whatever it takes,” Marino said. “We had  to be scrappy again.”

But Marino said that RockYou figured things out, and it had to get profitable with the cash it had in the bank, which dwindled down to $2 million. The team made a bet on programmatic video, which grew rapidly. RockYou reduced its sales team and made sure that its tech worked. The ad network is now No. 7 in terms of impressions delivered in the U.S. The ad network is run with just 13 people.

RockYou has low-cost teams in places such as India where it figures out how to operate these games for the loyal fans who still play them. Marino said that these fans are valuable because they have stayed loyal for a long time, and they are also more likely to be people who spent money in the games. RockYou further monetizes these audiences by showing them advertisements such as video ads.

RockYou is acquiring 16 employees with the PlayHaven deal, and that is in addition to the 250 employees it already has.