Walmart (WMT -0.08%) has been on the offensive lately. It excited investors last week with the announcement of a 3-for-1 stock split, and it captured attention again this week with reports that it might acquire smart TV maker Vizio.

But it's probably not looking to compete with the likes of industry leader Roku (ROKU -10.29%). This move is more about gaining the upper hand, or at least a competing hand, in its battle for consumer spending with perennial rival Amazon.

The pressure is building on Walmart

Walmart is still the largest U.S. company by sales, but Amazon is closing the gap. Amazon's revenue increased 12% year over year in 2023, and Walmart's revenue increased 2.7% over the trailing 12 months. This trend has been going on for years, but Walmart is just that much bigger, and Amazon has not been able to overtake it yet.

Amazon has also been much more profitable than Walmart over the past year.

WMT Revenue (TTM) Chart

WMT Revenue (TTM) data by YCharts

As much as these two like to duke it out over consumer discretionary spending, there are important differences in the businesses. Most specifically, Amazon has much more going on than retail. Amazon Web Services (AWS) is a cloud computing giant that has nothing to do with retail and accounts for 14% of the company's total sales. It also owns MGM Studios and and a large streaming network.

Amazon's fastest-growing segment, though, is advertising, and that's what Walmart is probably targeting with this acquisition.

Why advertising matters

Amazon has its own smart TV and streaming business, and it recently jumped on the ad-supported tier bandwagon for its Prime streaming network.

But it's been using its e-commerce platform as an advertising base. This makes a lot of sense, since third-party sellers can benefit from Amazon's artificial intelligence (AI) capabilities and target shoppers who are already looking for these kinds of products. The ad-supported streaming effort is new, but it should add considerable value to the ad business.

With the acquisition of Vizio, Walmart can get its own products right in the faces of viewers on Vizio's operating system. It's a well-matched arrangement; Vizio is Walmart's best-selling TV brand, and Walmart is Vizio's largest customer.

It's also a means to get into the third-party ad business, which has much higher margins than groceries and can pump up Walmart's profits.

Where does Roku fit in here?

Roku has the top streaming operating system (OS) in the U.S. and sells more devices than any rival, including Amazon. It has 75.8 million active accounts with 26.7 billion viewing hours versus 17.9 million Vizio SmartCast active accounts and 5.2 billion viewing hours. According to The Wall Street Journal, Roku's OS has 25% of the U.S. market share, while Amazon has 17% and Vizio 8%.

Vizio isn't a threat to Roku, but Roku's stock fell on this news. It seems that investors are intimidated by the Walmart brand moving into Roku's territory, even though Roku is holding its own against Amazon.

Will this help Walmart stock?

This isn't the first time Walmart has tried to branch out into new businesses. It was late to the e-commerce game, and the lag may have cost it market share in the long run. It currently accounts for the second-largest e-commerce market share in the U.S., but that's only 6.4%. Amazon accounts for 37.6%, according to Statista.

This might not move the needle for Walmart too much, even though it might be a good move to stay relevant. However, it shouldn't affect Roku too much, either. If anything, it underscores Roku's leadership and illustrates that it's still the company to beat.