(Alan Diaz/AP)

AT&T said Monday that it is buying the digital advertising company AppNexus, in an effort to hasten the growth of its new media empire.

AppNexus gives the telecom giant control over one of the world’s largest Internet advertising exchanges, which marketers use to buy ad space from online publishers. It could help AT&T challenge Google and Facebook — the two giants of online advertising —- by bolstering its ability to analyze customer behavior and advertise against content produced by Time Warner, now renamed WarnerMedia.

AT&T didn’t disclose the terms of the AppNexus deal, which came days after AT&T completed its landmark merger with Time Warner. AppNexus sought a valuation of $2 billion when it filed confidentially for an IPO in 2016. The acquisition is expected to close in the third quarter of 2018. Should the deal be finalized, AppNexus would rule out a public offering, the company said.

AT&T’s aggressive expansion underscores the speed at which the telecom industry is changing. No longer satisfied with selling access to voice services, mobile data and home Internet, providers such as AT&T are increasingly seeking control over digital media content that they can use to set themselves apart from the competition. The trend reflects a mind-set, common among Silicon Valley companies, that customer attention is a valuable product.

Companies across the broadband industry are catching on. A day after AT&T gained approval from a federal judge to purchase Time Warner, Comcast announced it was seeking to outbid Disney for cable networks and film studios controlled by 21st Century Fox. Verizon in recent years has also made moves to acquire content, purchasing AOL and then Yahoo in separate deals that sought to monetize their respective technologies and user bases.

The feeding frenzy has also spurred more traditional types of mergers, including T-Mobile’s proposed acquisition of Sprint, the nation’s third- and fourth-largest wireless networks. In an interview last week, Sprint CEO Michel Combes said he believes the combined company will face similar pressures to acquire digital content, whether by buying media properties or licensing their programming.

“Do I believe that moving forward, all the distributors — meaning the guys like us — will need to secure access to content? The answer is yes,” said Combes, who was appointed in May and is running day-to-day operations at Sprint while the T-Mobile merger is under review.

The deal could face regulatory scrutiny: Policymakers have previously signaled that competition is best preserved when consumers have access to at least four national cellular networks. But officials at both companies have argued that they cannot hope to compete alone against an enlarged AT&T and Verizon without bulking up themselves.

Sitting atop the digital ad industry are Facebook and Google, which together control more than half of the market for online advertising, according to eMarketer. But there are signs that that dominance may be eroding: In 2018, Facebook and Google will capture about 57 percent of the market, down from 58.5 percent a year ago, eMarketer projects. EMarketer attributes some of the shift to rising competition from sources such as Amazon.com and Snapchat. (Amazon CEO Jeffrey P. Bezos owns The Washington Post.)

AT&T hopes to be among them. Testifying in defense of the deal against the Justice Department this spring, AT&T CEO Randall Stephenson told a federal judge that advertisers are looking for alternative places to send their ad dollars.

That pressure has been rising in the wake of high-profile controversies in which ads have accidentally appeared alongside hate speech and other controversial content on YouTube and other platforms — an unintended consequence of the tech giants' algorithms.

The AppNexus deal gives AT&T some of the same capabilities as Google and Facebook, but with one crucial advantage: control over premium content.

“Marketers are increasingly interested in advertising in premium media environments where publishers have a direct relationship with the consumers,” said Joanna O’Connell, a marketing analyst at Forrester Research.

Still, whether AT&T could mount a credible challenge to the tech companies is uncertain. Facebook and Google enjoy an existing advantage in that they already operate their behavioral tracking and advertising technologies at massive scale — following Internet users across millions of websites, said Jason Kint, CEO of Digital Content Next, a trade association representing online content producers (including The Post).

“These two companies are able to collect data in a way that no one else can. Data is the source of their power," Kint said at a Washington conference last week.