Chinese tech giants Tencent (TCEHY -0.94%) and Baidu (BIDU 0.72%) both struggled over the past year as China's economy decelerated amid rising tariffs and trade tensions. Tencent's stock fell about 20% over the past 12 months, but Baidu fared much worse with a decline of over 50%.

The bulk of Baidu's decline occurred after it posted its first-ever quarterly loss in mid-May. Meanwhile, Tencent's stock stabilized after it posted a record profit for its first quarter. I own shares of both companies, but I think Tencent did four key things much better than Baidu over the past year.

Bear and bull figurines on top of a stock chart.

Image source: Getty Images.

1. A lower dependence on ads

Baidu and Tencent aren't directly affected by tariffs. However, the tariffs are hurting other companies and throttling purchases of online advertising in certain sectors. As a result, Chinese companies that generate most of their sales from online ads -- like Baidu and SINA -- struggled more than companies with better-diversified businesses.

Last quarter, Baidu's online marketing revenues, which accounted for 73% of its top line, rose just 3% year over year -- marking a steep drop from its double-digit growth in previous quarters. Baidu's total revenue rose 15% year over year, thanks to the growth of iQiyi (IQ), but the video streaming unit still lost money and contributed heavily to its quarterly loss.

Tencent's ad revenues, which accounted for just 16% of its top line, rose 25% year over year last quarter. That marked a slowdown from its 55% growth a year earlier, but Tencent's business is well diversified across the online gaming, social networking, fintech, and cloud markets.

Revenue from Tencent's "fintech and business services" segment -- which includes WeChat Pay, its wealth management services, and Tencent Cloud -- surged 44% year over year during the quarter and accounted for a quarter of its sales. Baidu is also invested in a wide range of other markets (like AI, smart speakers, and driverless cars) but none of those side bets generates enough revenue to reduce its dependence on ads.

2. A stickier ecosystem

Baidu controls 65% of China's search market, according to StatCounter. However, the stickiness of that search platform is wearing off as Chinese internet users spend more time on other apps, like Tencent's WeChat, ByteDance's TikTok, and Alipay, which is backed by Alibaba (BABA 0.64%).

WeChat, the most popular mobile messaging app in China with 1.1 billion global monthly active users, threatens Baidu because it corrals users into its ecosystem with over a million "mini programs" for games, deliveries, bookings, and more. Last November, Tencent stated that over 200 million people used those programs daily.

ByteDance and Alipay also recently launched mini programs for their apps. Baidu is trying to counter those challengers by launching similar programs for its mobile app, which grew its daily active users (DAUs) 28% annually to 174 million last quarter.

Unfortunately, Tencent has a first mover's advantage in the mini-programs market, and Baidu is spending a lot of money to gain more DAUs. That's why Baidu attributed a large portion of its net loss last quarter to a pricey (and arguably misguided) marketing campaign for the Baidu app during CCTV's annual special on Chinese New Year's Eve.

A young woman uses her smartphone.

Image source: Getty Images.

3. Tighter cost controls

Baidu's revenue growth slowed to a crawl last quarter, yet it still tossed money at driverless cars, smart speakers, cloud services, new apps (like its short video app Haokan) content for iQiyi, and massive marketing blitzes. As a result, its total operating expenses surged 53% year over year and its adjusted operating margin plummeted from 26% to 2%.

Meanwhile, Tencent's operating margin expanded 1 percentage point year over year to 43% last quarter. To cut costs, it restructured its businesses to prioritize the growth of its fintech, payment, and cloud services, laid off 10% of its managers, and reduced the gaming unit's spending during the nine-month freeze on new gaming approvals last year. Simply put, Tencent reined in its spending as Baidu tossed cash at hot tech trends without any clear plan for monetizing those nascent markets.

4. More meaningful buybacks

Lastly, Baidu tried to appease investors with a new $1 billion buyback plan that will last through July 1, 2020. But as I previously pointed out, that would account for less than 3% of Baidu's current market cap -- and barely move the needle for a stock that was cut in half. For now, that cash would arguably be better spent on diversifying its core business away from ads.

Tencent recently approved a far more meaningful buyback of roughly 10% of its outstanding shares. Since Tencent's core businesses are in better shape than Baidu's, it makes sense to repurchase its shares before its new growth engines (like its fintech, cloud, and payment businesses) gain more momentum.

Investors shouldn't abandon Baidu...yet

Baidu is stuck in a rut, and things could get worse before they improve. However, selling Baidu at a multiyear low when it trades at about 10 times forward earnings is likely the wrong move. Instead, investors should see if Baidu addresses its shortcomings over the next few quarters and then decide whether it's still a viable long-term investment.