For investors focused on the long game, downturns are par for the course. And when they happen, most stocks find themselves southbound. But downturns sometimes push some companies down too far, creating opportunities to invest in top stocks at a relative discount.

There are currently plenty of publicly traded companies to choose from that fit the bill. Let's focus on two tech giants: Roku (ROKU 5.41%) and Meta Platforms (META 2.98%). Despite their poor performance in the market this year, both companies could be up substantially in a decade. 

ROKU Chart

ROKU data by YCharts

1. Roku

Roku's stock is down by nearly 70% this year as the streaming company has faced multiple problems, some of which are related to macroeconomic headwinds. Roku makes much of its revenue through advertisements on its platform, and spending on ads has decreased as businesses deal with inflation, lower customer spending, and other issues. 

In the second quarter, Roku's revenue jumped by 18% year over year to $764.4 million. While that might be exemplary for many companies, it's a less impressive jump than what investors are accustomed to for Roku.

ROKU Revenue (Quarterly YoY Growth) Chart

ROKU Revenue (Quarterly YoY Growth) data by YCharts

Further, Roku reported a net loss per share of $0.82, compared to the net income per share of $0.52 reported during the year-ago quarter. Will these issues subside soon? In my view, the answer is probably no. We are still facing a challenging economic environment, and Roku is unlikely to fully recover, at least not until next year. On the other hand, Roku's stock is down to levels not seen in more than three years.

The sole fact that a stock is down is not a good reason to get in. But Roku has excellent prospects, and now might be a good time to purchase its shares while they look cheap relative to what they were a year or so ago. Roku's opportunities lie within the streaming industry. People are still ditching cable and buying devices like Roku's namesake player, allowing its users to access dozens of streaming platforms.

In the second quarter, Roku's active accounts increased by 14% year over year to 63.1 million. The company's streaming hours came in at 20.7 billion, 19% higher than the second quarter of the previous fiscal year. From the perspective of advertisers, a growing user base that spends more hours glued to their screens is a potential goldmine of targeted ads. However, this switch has yet to be fully realized.

Streaming passed legacy television in reach and engagement in adults between 18 and 49 during the first half of this year. But companies are still spending a relatively small percentage of their ad budget -- an estimated 22% this year -- on streaming. Roku estimates that there are 1 billion broadband households worldwide. As the company makes headway into this vast market, and as ad spending continues to be redirected toward streaming, Roku's revenue and profits should grow by leaps and bounds -- as will its stock price. 

2. Meta Platforms

Facebook parent Meta Platforms is facing some of the same issues as Roku. Lower spending on ads is harming the company's revenue. Meta Platforms recorded a (very) rare year-over-year revenue drop in the second quarter. The tech giant's top line declined by 1% to $28.8 billion. Even worse, net income dropped by 36% year over year to $6.7 billion.

However, there were some bright spots in Meta's earnings report. Most notably, the company continues to increase its user base. In the second quarter, Meta's monthly active users across all its websites and apps increased by 4% year over year to 3.65 billion. There is no social media company with as robust an ecosystem as Meta Platforms.

Name recognition matters. Facebook has become a go-to website for connecting with family and friends. Instagram attracts thousands of celebrities and influencers looking for an audience. WhatsApp is a free messaging system known for being able to work practically anywhere there is an internet connection. That's why Meta's websites and apps are among the most visited and downloaded in the world.

In other words, the company benefits from a strong brand name, a powerful intangible asset, and a competitive advantage.

Meta Platforms also benefits from the network effect, as the more its user base grows, the more its platforms become valuable to potential future users. What does this all mean for the company's future? Short-term economic issues aside, Meta Platforms will continue to benefit from the growth in online spending on ads.

The strong ecosystem it has built is still attracting new users. And advertisers will start flocking to its platforms once again after the economic situation improves. Meta Platforms is looking at other avenues to spur growth, including a push into e-commerce and its much-discussed metaverse ambition, which could be a massive opportunity.

Meta Platforms will continue to seek ways to monetize its massive ecosystem. Along with a recovery in ad spending, the tech giant's opportunities should help it turn things around. Buying the company's shares while they are down by 56% this year seems like a great move.