Google and Facebook have a powerful grip on the digital ad industry. Media and telecom companies are looking for ways to loosen it.

AT&T (T) is the latest. It announced plans Monday to buy AppNexus, a digital technology firm that runs one of the world's biggest online ad marketplaces, matching buyers and sellers.

The move comes less than two weeks after AT&T closed its $85 billion purchase of Time Warner, the parent company of CNN.

AT&T didn't say how much it paid for AppNexus, though the The Wall Street Journal and Reuters previously reported the deal's value at around $1.6 billion.

For AT&T, the purchase offers a foothold in the digital ad business, dominated by Google and Facebook. Rivals such as Verizon (VZ), which owns a digital ad service through its subsidiary Oath, are trying similar strategies.

The gap is large. Last year, Google and Facebook raked in a combined $114 billion in net digital ad revenue worldwide, according to the research company eMarketer. Together, they accounted for a nearly 49% share of the market. Verizon's Oath was one of only five other companies with at least a 2% market share.

Related: Will Verizon join media merger mania?

AT&T thinks its new deal will allow it to make more money selling targeted ads on its own products, including the streaming service DirecTV Now, as well as all of the new TV and digital media it acquired from Time Warner -— channels like TNT, HBO and CNN. The company also says it already has more than 170 million "relationships" with people across its wireless, video and broadband businesses.

One source familiar with the AppNexus deal said it's about finding better ways to measure the success of an ad campaign on TV and video. As technology advances, the person said, the techniques already present in digital advertising can theoretically be used on a wider, more sophisticated scale.

For example, the person said, AT&T could potentially use anonymized data to figure out whether someone who sees a truck ad on TV later visits the truck maker's website, or whether that person goes to a dealership to test drive the model. Knowing how the ad influenced a viewer could inform later campaigns, the person said.

Hypothetically, the person added, better technology would also help advertisers tweak ad campaigns on the fly — for example, shortening or swapping out ads during a TV show from night to night.

"Ad tech unites real-time analytics and technology with our premium TV and video content," AT&T Advertising CEO Brian Lesser said in a news release. He was tapped by the company to build an advertising unit last August. "We went out and found the strongest player in the space."

Related: AT&T quickly rolls out streaming TV service after Time Warner deal

Mike Tyrrell, who was an AppNexus investor and board member, said AT&T signaled its ambition in advertising by hiring Lesser, a veteran of the digital ad industry.

"The TV advertising industry today is not nearly as efficient as the online advertising industry, and I think overtime those worlds will merge," Tyrrell said. "I think AT&T will be extremely well positioned to take advantage of it."

Brian Wieser, an analyst for Pivotal Research, said AT&T has its work cut out.

"There's often a belief that the network the [telecommunications companies] operate or produce data which can or should add value to the digital media owner," he added. "I think that's pretty limited."

Wieser also praised Lesser's expertise, but added that Lesser needs to be given the freedom to build the business his way.

And he added that AT&T needs to think seriously about how it uses its customer data. Facebook's data collection practices created a media firestorm this year because of questions about how it uses and distributes people's private data.

"They have to be more aggressive than ever before on putting consumers first," Wieser said of AT&T.