The darkening economic outlook has adversely impacted companies in the digital advertising space of late. Red-hot inflation, rising interest rates, and geopolitical concerns have caused businesses to tighten their purse strings, with the first step often being slashing their advertising budgets. In response to the latest trends, investors weren't very optimistic prior to Trade Desk's (TTD -4.34%) second-quarter earnings announcement, which occurred on Aug. 9. 

Trade Desk offers a marketplace for consumers to buy different types of advertisements. It showed great resiliency in its most recent quarter, beating both analysts' top and bottom line estimates. Following its Q2 earnings call, Trade Desk stock jumped more than 30%, begging the question: Did investors miss out on all the big gains for the ad-tech company?

The stock has cooled down a bit since its post-earnings climb and year to date it's still down 33.4%. However, it's certainly worth having a look at Trade Desk today. Let's examine its current situation and determine if investors should consider it a buy right now.

Person sitting in wheelchair at desk with laptop.

Image source: Getty Images.

Trade Desk's resilient second-quarter performance

In Q2, the ad-tech company's total revenue rose 35% year over year to $377 million, which is particularly impressive given it was up against a 101% growth rate in the same quarter a year ago. Trade Desk, which is normally profitable, also endured a net loss of $19 million during the quarter, driven primarily by a $66 million performance grant to Co-Founder and CEO Jeff Green. Still, its adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) increased 17.8% to $138.9 million, translating to an EBITDA margin of 36.9%.

So, what allowed Trade Desk to perform well in the middle of a gloomy economic backdrop? Green pointed to three factors that are helping propel the company forward: the growing connected television (CTV) market, the shift away from walled-garden platforms, and worldwide pressure on Alphabet. According to Statista, the CTV ad market is forecast to expand from $14.2 billion in 2021 to $38.8 billion by 2026, indicating a compound annual growth rate (CAGR) of 22%. Thus, Trade Desk is well positioned to benefit from the booming industry moving forward. 

The shift to CTV has led to walled gardens like Alphabet and Meta Platforms to be downgraded in priority. Because there's not a dominant player in the arena, the CTV ad market is extremely fair and competitive, which has attracted the advertising dollars of many of the world's biggest brands. Put simply, a walled garden in digital advertising describes a platform that keeps information and data to itself without sharing it with its users. Alphabet has faced plenty of regulatory scrutiny over the years, which could negatively impact its ad business over the long run.

This year, Wall Street analysts expect Trade Desk's total revenue to climb 32.7% year over year to $1.6 billion. Next year, analysts forecast its top line to grow another 24.6%, up to $2 billion. Those rock-solid growth rates indicate that the company is firmly positioned to continue benefiting from the upward trajectory of the digital ad market in the years to follow. 

Is Trade Desk stock a buy right now?

After its recent boost, the stock trades at a price-to-sales (P/S) multiple of 21.3x. That's an expensive price tag at face value, but it's actually below its 5-year mean of 25.8x. That said, considering Trade Desk's historical valuation levels and its long runway for growth, I think today's price offers a fine entry point. Not only does the digital ad market continue to grow at a rapid clip, but it's quite evident that customers are extremely satisfied with Trade Desk. As of Q2, the company's customer retention remained above 95%, marking the eighth-consecutive quarter at or above those levels. Looking ahead, I believe Trade Desk stock has a great chance to generate massive gains for patient, long-term investors.