Alphabet (GOOG 1.77%) (GOOGL 1.77%) and Datadog (DDOG 7.01%) represent two very different ways to profit from the secular growth of the cloud and AI markets. Alphabet's Google owns the world's most popular search engine and third-largest cloud infrastructure platform. Its sprawling ecosystem also houses YouTube, Android, Chrome, Gmail, Google Docs, and its other cloud-based services. Datadog collects diagnostic data from an organization's entire software infrastructure in real time, then aggregates all of that information onto unified dashboards for IT professionals.

Both companies faced tough macro headwinds over the past 12 months, but Alphabet's stock still rallied 33% as Datadog's stock slumped 7%. Let's see why the diversified tech giant outperformed the cloud-based observability software provider by such a wide margin, and if it will remain the better buy for the foreseeable future.

A person uses a smartphone, laptop, and tablet which are all tethered to cloud-based services.

Image source: Getty Images.

Alphabet's advertising business is recovering

Alphabet still generated 78% of its revenue from Google's advertising business -- which includes its search, network, and YouTube ads -- in its latest quarter. That core business suffered a slowdown throughout 2022 as inflation, rising interest rates, and other macro headwinds drove many companies to rein in their ad purchases.

However, Google's advertising growth accelerated again in the first two quarters of 2023 as its ad sales stabilized. Its cloud business faced a milder slowdown than those of its two larger rivals, Amazon Web Services (AWS) and Microsoft Azure, while the growth of its non-advertising businesses accelerated as it sold more Pixel devices and locked in more paid subscribers with YouTube Music and YouTube Premium.

Analysts expect Alphabet's revenue and earnings per share (EPS) to grow 8% and 24%, respectively, for the full year. For 2024, they expect its revenue and EPS to rise 11% and 18%, respectively, as the macro environment improves.

Alphabet's stock looks reasonably valued at 20 times forward earnings, but it faces unpredictable competitive and regulatory headwinds. ByteDance's TikTok and other popular apps could chip away at Google's advertising business, Microsoft remains a tough rival in the cloud and AI markets, and it's embroiled in a landmark antitrust trial in the United States. All those threats could dispel the notion that Alphabet is an evergreen play on the advertising, cloud, and AI markets.

Datadog isn't growing into its valuations

Datadog went public in 2019, and its annual revenue grew at a jaw-dropping compound annual growth rate (CAGR) of 67% from 2019 to 2022. But for 2023 it expects just 22% to 23% revenue growth even as it adds more AI-driven features to its observability platform.

Like many other software companies, Datadog blames that slowdown on the macro headwinds. Its growth in larger customers (which generate at least $100,000 in annual recurring revenue) decelerated significantly over the past year, and it still faces plenty of competition from similar cloud-based observability companies like Cisco's AppDynamics and New Relic.

Unlike Alphabet, which is consistently profitable by both generally accepted accounting principles (GAAP) and non-GAAP measures, Datadog is only profitable on a non-GAAP basis because it still spends a large portion of its revenue on its stock-based compensation expenses. However, its non-GAAP EPS more than doubled in 2022 and it expects 33% to 37% growth this year as it slows down its hiring and implements other cost-cutting measures.

Datadog's slowdown wasn't disastrous, but it likely disappointed investors who had expected it to remain a hypergrowth stock for at least a few more years. Datadog's stock has already dropped more than 50% from its all-time high in Nov. 2021, but it still doesn't look like a bargain at 54 times forward earnings. That high valuation and lack of GAAP profits could make it an unappealing investment as long as interest rates stay elevated.

The winner: Alphabet

Alphabet's near-term macro, competitive, and regulatory challenges are compressing its valuations, but it's still an 800-pound gorilla of the advertising, cloud, and AI markets and stands to outlast many of its smaller competitors. Datadog is an underdog that could still have room to grow across the fragmented observability market, but its stock could remain out of favor until its revenue growth accelerates again. That's why I believe Alphabet will remain a better buy than Datadog.