Alphabet's (NASDAQ:GOOG) (NASDAQ:GOOGL) Google and Facebook (NASDAQ:FB) are two of the world's largest digital advertising platforms. Google owns the world's largest search engine, which processes over 3.5 billion searches daily, while Facebook owns the largest social network with 2.6 billion monthly active users.

But over the past five years, Facebook's stock rallied nearly 190% against Alphabet's gain of about 150%. Let's see why that happened, and why Facebook could remain the better digital advertising stock.

A man uses a laptop computer.

Image source: Getty Images.

A clearer focus with a visionary leader

Facebook co-founder Mark Zuckerberg has been the company's only CEO throughout its history as a private and public company. Zuckerberg oversaw the expansion of Facebook into the world's largest social network, and strategically acquired Instagram, WhatsApp, and Oculus VR to expand its ecosystem.

Instagram strengthened its foothold with younger users, WhatsApp helped it reach a broader market of global users who preferred spartan messaging apps, and Oculus gave it a first-mover's advantage in the nascent VR market. Zuckerberg plans to gradually unite and monetize that family of apps while expanding VR into a next-gen computing platform.

That transformation could tighten Facebook's grip on the roughly 3 billion people who use its family of apps monthly, and it can set up a stronger foundation for its fintech, e-commerce, in-platform gaming, and streaming video efforts.

A woman uses a smartphone.

Image source: Getty Images.

By comparison, Alphabet's co-founders Larry Page and Sergey Brin no longer lead the company. Tech veteran Eric Schmidt served as the company's CEO from 2001 to 2011 before handing the reins back to Larry Page. However, Page mainly took on a passive role at Google's parent company Alphabet, while Google CEO Sundar Pichai handled the day-to-day operations.

Pichai succeeded Page as Alphabet's CEO last December, but his vision for Google's future is arguably murkier than Zuckerberg's goals for Facebook. Pichai pursued controversial projects, including a censored search engine in China and a Pentagon AI contract, but canceled them after protests from employees.

Pichai's Google repeatedly chased Facebook, Snap, Pinterest, Zoom, and other social media and messaging rivals with similar apps, but most of those efforts flopped. It also failed to catch up to Amazon and Microsoft in the cloud market, and lost a closely watched natural language AI match with its Chinese counterpart Baidu last year. Beyond online search, Pichai's Google is a jack of all trades and a master of none.

A simpler business with fewer side projects

Facebook generated 98% of its revenue from online ads last quarter. The remaining 2% mainly came from sales of its Oculus VR devices and Portal smart screens. Facebook is likely selling its Oculus headsets and Portal devices at slim to negative margins, but it easily offsets those losses with its high-margin advertising revenue.

Alphabet generated 82% of its revenue from Google's ads last quarter. About 7% came from Google's cloud business, 11% came from Google's "other" businesses (including hardware sales and YouTube's membership revenues), and the remaining sliver came from "other bets" like driverless cars and healthcare.

However, the "other bets" segment racked up an operating loss of $1.12 billion (compared to Alphabet's total operating profit of $7.97 billion) while only generating $135 million in revenue. It doesn't disclose YouTube and Google Cloud's operating profits separately, but the two units are also likely unprofitable. That messy business causes Alphabet to consistently generate lower operating margins than Facebook:

GOOGL Operating Margin (TTM) Chart

Data source: YCharts.

Social media ads are more refined than search-based ones

Facebook crafts targeted ads based on a user's social media profile, network interactions, followed brands, and other online activity. Google's ads are mainly based on a user's online searches, browsing and location history, and other data.

Facebook's advertising platform, which includes Instagram and its Audience network for third-party websites and apps, is arguably more lucrative to advertisers targeting more granular demographics than Google.

Google repeatedly tried to counter Facebook with its own social networks -- including Friend Connect, Orkut, Jaiku, Buzz, and Google+ -- but none of those platforms gained any traction against the market leader.

The key takeaways

Alphabet and Facebook are still solid investments since the world will remain addicted to Google's search engine and Facebook's family of apps for the foreseeable future. But as a pure online advertising play, Facebook's tougher leader, simpler business model, and dominance of social advertising make it the better overall investment.