The technology sector has done remarkably well in spite of the pandemic. The Dow Jones Industrial Average is down 3% and the S&P 500 is up 6%, but the tech-heavy NASDAQ has gained an impressive 26% year to date.

Investors shouldn't overlook this important and growing sector. It's home to some of the most innovative companies around, which can lead to market-beating results. There are also underlying trends that can provide investors with even more lucrative gains.

Here are my three top tech stocks to buy in July. See if you can spot the central theme.

Smiling couple watching streaming video on a tablet.

Image source: Getty Images.

Roku: An under-the-radar streaming leader

Roku (ROKU -10.29%) pioneered the set-top streaming device. While that's still in its arsenal, the company has become so much more, making the majority of its revenue from advertising on its platform. Not only does the company control the valuable real estate on its landing page, but it also gets all the ad revenue from The Roku Channel and a cut from the thousands of ad-supported channels on its platform.

Its secret weapon may be the smart TV operating system (OS) it licenses to manufacturers. This was built from the ground up, not repurposed from an existing mobile OS. The Roku OS was found in one in three smart TVs sold in the U.S. last year, and in a quarter of those sold in Canada. This gives the company a massive installed base of devices from which to attract new viewers. 

Business is booming. During the first quarter, Roku's active accounts increased 37% year over year, while streaming hours and average revenue per user (ARPU) climbed 49% and 28%, respectively. Platform revenue -- which consists of advertising, The Roku Channel, and the OS licensing -- grew 73%, and now accounts for 73% of Roku's total revenue. Player sales climbed 22%, but it's important to note that Roku sells its devices at cost in order to draw people into its streaming video ecosystem. 

Roku's stock is treading water so far this year due to uncertainty about the pandemic and cuts to advertising budgets. With a forward price-to-sales ratio of 10, the stock isn't exactly cheap. Look out several years, however, and buying the stock at this price could be a bargain.

Two hands touching a digital orb showing various consumer advertising touchpoints.

Image source: Getty Images.

The Trade Desk: Not your grandfather's advertising

Some companies haven't recovered from the pandemic-induced swoon that happened in late February and early March, but not The Trade Desk (TTD 1.67%). Investors feared the worst for the company. After shedding more than half its value over a one-month period, the stock has come roaring back, climbing to new all-time highs and gaining more than 200% from its March lows.

What has investors so jazzed about The Trade Desk's prospects? Simply put, the company is at the forefront of digital advertising, with plenty of room to run. Using a process called programmatic advertising, the company's lightning-fast system and state-of-the-art algorithms can evaluate 9 million ad impressions and quadrillions of permutations per second. This real-time bidding technology has made The Trade Desk the go-to for major ad agencies and boutique marketers alike.  

The company's secret weapon, however, is its transparent pricing model, which bucks industry convention. The Trade Desk lets ad buyers know exactly what the ad slot costs and charges a fair markup. This practice creates strong loyalty among its users. Customer retention has stayed above 95% for five years running. 

The Trade Desk reported revenue that grew 33% year over year, edging down only slightly from the fourth quarter's 35% growth. The company's high-growth channels continued their phenomenal growth, with mobile in-app and audio spending climbing 55% and 60%, respectively. Even more impressive were mobile video and connected TV (CTV) spending, up 74% and 100%, respectively.

With the recent surge in the stock price, The Trade Desk valuation is a bit on the lofty side at 29 times forward sales, but investors have thus far been willing to pay for quality.

A TV or PC monitor showing viewing options and apps.

Image source: Getty Images.

Telaria, The Rubicon Project, or Magnite? A rose by any other name...

If you recognize any of these company names, you're likely in the minority. Late last year, CTV advertising company Telaria and sell-side ad specialist The Rubicon Project agreed to join forces to create the world's largest independent sell-side advertising platform, now trading under the name Magnite (MGNI 4.43%)

Where The Trade Desk helps marketers buy from available slots for their advertising (buy-side), Magnite works on the other side of the transaction, selling available slots for those ads (sell-side).

The new company brings many synergies. The Rubicon Project focused on a variety of ad channels, including desktop, mobile, and audio, while Telaria focused primarily on CTV advertising -- the hidden gem in the merger, delivering triple-digit revenue growth throughout 2019. Magnite's programmatic platform can now offer advertising across all screens and formats. 

Because Magnite deals in advertising, the pandemic took some of the wind out of its sails. For the first quarter -- before the merger was finalized -- The Rubicon Project reported revenue growth of 12% year over year, while its net loss improved. Telaria faced similar headwinds, as revenue grew 11%, CTV revenue grew 74%, and operating income slipped to a loss. The stock has lost 50% of its value since mid-February, giving investors an opportunity to buy shares on the cheap.

This is a somewhat risky recommendation. Even after the merger, the combined company has a market cap of less than $1 billion, making it much more volatile than your average stock. It is, however, downright cheap, at just 3 times forward sales. It's important to note that Magnite is currently unprofitable, but it carries a great potential payoff.

The common thread

Eagle-eyed investors will have realized by now that CTV was the theme uniting these technology companies. There were an estimated 203 million CTV users in the U.S. in 2019. At the same time, advertising dollars have been slow to migrate from traditional broadcast television to streaming. While streaming accounts for about 29% of television viewing, just 3% of television advertising budgets are spent there. 

This illustrates the large and growing market for companies that benefit, directly or indirectly, from advertising in the CTV space. A paradigm shift is occurring, and investors have the opportunity to profit from it.