Investors have been punishing tech stocks as if they're all seeing significant plunges in business activity. The tech-heavy Nasdaq Composite index has fallen more than 32% in 2022, and many individual names are down far greater. However, while it might seem like tech stocks can't please investors in this environment, a few companies are continuing to post stellar quarterly earnings results. 

Datadog (DDOG 1.19%) and Cloudflare (NET -1.47%) are two such companies. Both continued to dominate their respective industries and grew like wildfire in the third quarter. Yet, shares of Datadog and Cloudflare are down 60% and 69% year to date, respectively. These drops seem like appealing buying opportunities for investors willing to hold these two spectacular stocks for the long haul. Here's why. 

Person clicking on a virtual lock connected to the cloud.

Image source: Getty Images.

The case for Datadog

Datadog continued to execute flawlessly in the third quarter, as it showcased in its quarterly earnings on Nov. 3. Revenue soared 61% year over year to $437 million for the application performance monitoring company, and customers continued to shell out cash: The number of customers spending over $100,000 annually rose 44% compared to the year-ago period to about 2,600.

The company provides businesses with application and infrastructure performance and observability tools to understand user behavior, reduce application downtime, drive product development, and much more. Therefore, it makes sense Datadog has seen such stable adoption this year. Considering these tools are critical for businesses in today's world, Datadog's customers are less likely to drop its services -- even during an uncertain economic period. 

This was the case last quarter when Datadog's churn remained under 5%, and its net retention remained above 130% for the 21st consecutive quarter.

But that's not all, Datadog is profitable on a non-GAAP (adjusted) basis, and it generates a lot of cash. In the third quarter, the company had a non-GAAP operating margin of 17%, indicating its current rate of expansion isn't being artificially boosted by excess losses. Additionally, the company generated almost $304 million in operating cash flow year to date.

What does Datadog plan to do with this cash? It will likely use it to innovate and develop new products -- something the company does quite well. In 2022 alone, Datadog launched 10 new products, and it expects to roll out even more before year-end. This constant drive to give its customers the latest advancements in application monitoring has helped it become the leader in the space, according to Gartner. With this continued cash generation, combined with its desire to innovate, Datadog will likely maintain this top-dog status for years to come. 

Despite the company's high growth, low churn, cash flows, and sustainable leadership position, shares have continued to drop this year. However, smart investors looking to buy and hold companies for the long haul could see this as an opportune time to buy. At 15 times sales, Datadog is trading at both its lowest valuation since early 2020 and half its average valuation since going public. Shares still trade at a premium, but this looks like a spectacular stock to buy on the dip.

The case for Cloudflare

Cloudflare is in a similar position to Datadog. The company provides mission-critical cybersecurity tools to customers, and these tools are something businesses need nonstop -- even during economic turmoil. As a result, Cloudflare has continued to see stellar adoption. Third-quarter revenue jumped 47% year over year to $254 million. The company's net retention rate fell sequentially from 126% to 124%, but what didn't worsen was churn, which remained below 10%.

This adoption has paid off, not only through the company's increased success in the cybersecurity market but also through its operating margin. The company has seen revenue soar, but its operating expenses haven't increased at the same rate, resulting in impressive leverage. In 2019, for example, sales and marketing spending represented 52% of revenue, and research and development expenses totaled 27%. Those figures have dramatically fallen to represent only 41% and 18% of total revenue, respectively, in the latest quarter.

Like Datadog, Cloudflare's stock price hasn't been rewarded for this strong performance. Shares have fallen 69% year to date, bringing the company's valuation down to 15 times sales. This might be a great time to buy, considering Cloudflare is trading at similar multiples to some of its cybersecurity peers.

With the stock down even as the business continues to execute, investors can pounce on this high-quality business.