The Nasdaq Composite index has not been kind to tech investors this year, considering it has dropped more than 30% year to date as of this writing. However, individual tech investors are likely feeling even more pain. Many tech stocks are down more than 30% from their all-time highs. 

Roku (ROKU -9.36%) and PubMatic (PUBM 2.16%) fall into this bucket, down 83% and 73% from their all-time highs, respectively. However, just because these businesses are down, it does not mean they are out. If Roku and PubMatic can execute on a few key opportunities, both could bounce back over the coming years and be great investments for those who get in now. 

1. Roku

To say the least, it has been painful to be a Roku investor. Shares took a hit because supply chain disruptions caused TV prices to jump, which decreased unit sales. Now, some investors believe that with a possible recession on the horizon, consumers will be less likely to buy new TVs. Both of these factors either slowed or would slow new account growth for Roku, which worries investors.

However, these are both short-term problems, and the long-term trends pushing Roku forward are still in full swing. Streaming in the U.S. among adults ages 18-49 surpassed legacy TV for the first time in terms of reach, with 65% of adults streaming TV while only 63% watched legacy cable TV in March.

Advertisers also have yet to move more of their ad budgets toward streaming, which could be a major opportunity for Roku. As the largest streaming platform in North America by hours streamed, with over 61 million active accounts, the company is a top dog. It could use this leadership to become the primary place advertisers spend their streaming ad budgets. 

Roku even generated $183 million in free cash flow over the trailing 12 months, which it can reinvest to further its leadership.

If it can continue to take advantage of the shift in where ad dollars go -- as shown through its average revenue per user -- Roku could be successful from here. It's also worth monitoring hours streamed and active account expansion to ensure it stays the top dog (and thus the most attractive space for advertisers). If Roku can do both of those things, shares might be a steal at its current valuation of four times sales -- its lowest valuation since 2017. 

2. PubMatic

PubMatic operates in the advertising industry by helping publishers fill their digital ad inventories. Looking ahead, digital advertising will likely be much more widespread: Global digital ad spending is expected to total $627 billion by 2024. As one of the most used sell-side platforms in the advertising technology (adtech) industry, according to Advertiser Perceptions, PubMatic looks poised to capitalize on this large market. 

So what has caused PubMatic to sell off? Like many advertising companies, the risk of a recession is taking a toll. One of the easiest places to rein in spending is advertising, which would significantly affect adtech companies during a recession.

Nonetheless, the risk of a recession is most likely a short-term headwind and does not significantly impace the long-term opportunity ahead of PubMatic today. There is competition on the sell side of the adtech space, but PubMatic looks most appealing, primarily because of one unique trait. 

Unlike most rivals that store data on third-party cloud alternatives, PubMatic owns and operates its own tech infrastructure. While this was likely expensive to build, it is significantly cheaper to maintain compared to using third-party alternatives, which has allowed PubMatic to be much more profitable than its peers. For example, PubMatic had a 9% net income margin and a 27.5% free cash flow margin in the first quarter, while its rival Magnite (MGNI 3.81%) had a 38% net loss margin and a 9% free cash flow margin over the same period.

This edge could allow the company to reinvest significantly more into its business, especially during a recession. After all, if its rivals are unprofitable and forced to cut back investments to stay afloat, PubMatic could continue innovating with its cash flows and gain market share. 

Despite operating in a large market and having a sustainable competitive advantage, shares are trading at a bargain. PubMatic is priced at 19 times earnings, significantly cheaper than Magnite's price-to-earnings ratio of 897.

While there might be dark clouds in the short term for PubMatic, the company looks robust enough to weather the storm and come out stronger on the other side. That could help it capture share in this large space, potentially making it a great investment to buy now and hold for the long term.