ComScore Inc., the Internet researcher, agreed to buy Rentrak Corp. in an all-stock merger valued at more than $800 million, combining two media-monitoring companies to create a more formidable rival to Nielsen.

Investors will receive 1.15 shares of ComScore for each Rentrak share they own, according to a statement Tuesday from the companies. ComScore gained in extended trading after the announcement, rising as high as $45, suggesting the deal could be worth as much as $51.75 a share to stockholders of Rentrak, which also advanced.

The merger represents a new challenge to Nielsen Holdings Plc, which produces the TV audience ratings that underpin advertising rates and does a range of research for media and consumer-products companies. The deal combines two of its competitors -- ComScore tracks Web activity while Rentrak reports on TV viewing, DVD sales and the movie box office, as well as some online activity.

“The advertiser doesn’t care whether people use the TV or the Internet,” Rentrak Chief Executive Officer Bill Livek, who will be vice chairman and president of the new company, said in an interview. “They just want the best possible measurement.”

Rentrak rose as much as 15 percent to $50 in extended trading after the announcement. The stock fell 1 percent to $43.39 at the close in New York. ComScore lost 3.9 percent to $41.47 at the close in New York before gaining afterward. Investors in Reston, Virginia-based ComScore are expected to own about two-thirds of the company, according to the statement.

New ways of watching TV -- on DVRs, on-demand and the Internet -- have made it tougher for advertisers to reach consumers. It’s also complicated the task of determining how many people are watching a TV series or movie, the bedrock numbers that determine how much ads should cost. With the merger, ComScore will combine its data on computers, smartphones and tablets with Rentrak’s capabilities in theaters, on TV and video on demand, executives of both companies said.

“Obviously they want to understand what’s going on in viewing behavior across all devices,” saidComScore CEO Serge Matta, who will lead the combined company. “This allows them now to have that data.”

ComScore said the deal will reduce earnings per share in 2016 and then add to profit. The combined company expects to realize cost savings of at least $20 million next year and at least $35 million in 2017, according to the statement. The transaction is expected to close in early 2016, the companies said.

No job cuts are planned, the two executives said.

WPP Plc, the world’s biggest advertising company, is the largest stockholder in Portland, Oregon-based Rentrak, with almost 20 percent, according to data compiled by Bloomberg. WPP also owns about 15 percent of ComScore.

The ad agency will hold 16 percent of the combined company and have an option to increase its stake to 20 percent, according to Matta. WPP won’t have a board seat, he said.

“It’s just an investment,” Matta said. ComScore is committed to “providing independent and trusted metrics.”

Nielsen, the pioneer in TV ratings, says it already addresses changing viewer habits, with data that can measure the total audience of TV programming across all screens. 

“All of our data is fully representative of the U.S. population, and we deliver truly independent measurement,” Laura Nelson, a Nielsen spokeswoman, said in a statement. “There are myriad analytics options for the media industry, but Nielsen’s focus is on delivering the actual currency ratings data used for trading billions of dollars in advertising.”

Media stocks tumbled in early August after Walt Disney Co. cut its forecast for cable TV earnings, citing fewer subscribers at networks such as ESPN, its most profitable business. That renewed investor fears that subscriber losses in pay TV would accelerate.

“All of that panic that ensued on Disney meltdown day happened because there’s not correct measurement in the marketplace,” Livek said. “More people are watching ad supported TV. They’re just watching it over 28 days.”