Facebook (META -4.13%) and Google, the Alphabet (GOOG -1.10%) (GOOGL -1.23%) subsidiary, are considered an unofficial duopoly in digital advertising. The two companies account for the majority of digital ad spending in the United States. Despite strong competition from companies like Snap (SNAP -4.04%) and Amazon, the two aren't expected to see a significant dent in their share of the fast-growing digital ad market.

Investors looking to capitalize on the shift in ad spending toward digital would do well with either Facebook or Alphabet stock. Personally, I own shares of both companies. But if you had to choose one stock today, which should it be?

The ABCs of Alphabet

Google's dominance in digital advertising is supported by its Search business, which remains incredibly strong, but it's becoming more and more difficult to maintain it. Google's position in product searches, in particular, is challenged by Amazon.

Meanwhile, the shift to mobile is putting pressure on Google's traffic acquisition costs, which are much higher on mobile than on desktop. The majority of desktop users use Google's Chrome browser, which reduces its traffic acquisition costs. But Google pays high fees to companies like Apple for mobile traffic. Of course, Google is in an excellent position to continue paying for traffic, as it's bringing in around $100 billion in ad revenue per year.

YouTube is a driving force behind Google's ad revenue growth. Analysts estimate the video-streaming website could generate $15 billion this year (and that's actually conservative, in my opinion). As more consumers cut the cord and fill their time with streaming video, YouTube stands to benefit. Not only does it offer one of the largest collections of free videos, it also offers a subscription service to remove ads and a linear television replacement service, YouTube TV.

Google also includes a hardware division, which is responsible for producing things like the Pixel phone, Google Home, and Nest thermostats. The hardware division is growing quickly thanks to the growing popularity of smart speakers and smart-home devices. Google's acquisition of HTC earlier this year positions it well to integrate hardware and software on a deeper level, creating a certain amount of differentiation in its Pixel phones compared to most everyone else.

Google employees wearing colored shirts and forming the G logo for Google on a grassy lawn

Image source: Google.

Alphabet's cloud computing segment remains a key part of its Google division as well. CFO Ruth Porat has said it's the fastest-growing public cloud service in the industry. Google's strength in machine learning gives it an advantage over Amazon Web Services when it comes to developing apps that could use artificial intelligence.

Finally, there's Alphabet's "other bets." While revenue from the division has thus far stemmed largely from Google Fiber and Verily -- its home internet and video and life sciences divisions -- another moonshot is getting set to start generating revenue as early as this year.

Waymo has acquired the necessary permits to operate a self-driving taxi service in Arizona, and plans to expand to other markets quickly. It just signed a deal to increase its fleet of self-driving minivans by 100 times, asking for delivery of 62,000 Chrysler Pacifica minivans from Fiat Chrysler Automobiles. Additionally, Uber is reportedly in talks with Waymo about partnering after Uber put a pause on its autonomous vehicle research in Arizona following a fatal accident with a pedestrian earlier this year. Waymo already has a partnership in place with Lyft.

Alphabet's core Google business is growing quickly and it looks like one of its other bets is close to shooting the moon. Investors should expect continued strong revenue growth, and while operating margins will feel pressure in the near term, they should normalize and even expand over time, especially if Waymo becomes the next Uber.

Nothing is slowing down Facebook

Facebook has 2.2 billion monthly users on its flagship app, and its still growing at a double-digit rate. That's faster than most smaller competitors can say. Even Snap, which has less than one-seventh the users of Facebook, grew its daily users just 15% year over year in the first quarter, compared to 13% for Facebook.

And users spend a ton of time on Facebook. The average daily user spends over 40 minutes per day in the big blue app. For comparison, Snap says Snapchat users spend over 30 minutes per day.

Facebook also owns Instagram, where 500 million daily users spend around another 30 minutes per day. And WhatsApp and Messenger each see tens of billions of messages sent every day. WhatsApp Status -- the Snapchat Stories clone in WhatsApp -- recently surpassed 450 million daily users, although there's no data on how much time people spend sharing stories in the app.

Mark Zuckerberg holding a microphone

Mark Zuckerberg. Image source: Facebook.

Facebook does face its share of challenges, though. There's a heightened risk of regulation following the fallout of the Cambridge Analytica scandal. The company already faces greater regulation in Europe following the enactment of GDPR in late May. GDPR forces Facebook to disclose to its users what data it collects and why and also puts limitations on that data, potentially impacting the effectiveness of its advertisements.

Facebook has also reached the limit on the number of ads it can show in News Feed before it has a negative impact on the user experience. That said, demand for its ads remains strong, and ad price increases have kept its revenue growth rate high. There's also room for more advertisements within Instagram and its Stories products.

Like Alphabet, Facebook also has a few other bets it's working on. It has Facebook Watch, a video platform to rival YouTube, in which it's investing up to $1 billion in content. It's certainly no YouTube killer, but Facebook is simply looking to expand into the active video consumption market.

Its bigger long-term bet is Oculus VR, a company Facebook paid about $3 billion for in 2014. Oculus just released its first stand-alone device intended for mass audiences at the beginning of last month. Facebook CEO Mark Zuckerberg believes virtual reality is the next big computing platform after mobile, and it's certainly well-positioned to take advantage of it.

Like Alphabet, Facebook is growing quickly despite facing some challenges. The regulations from GDPR and the fallout from Cambridge Analytica have compelled Facebook to increase its hiring in security, which will negatively impact its operating margin in the short term. But it should see expansion in the long term as it moves to further monetize its ancillary products like Instagram and WhatsApp and Oculus moves closer to the mainstream.

So which is a better buy?

Both Facebook and Alphabet are absolutely crushing it operationally. As I wrote above, investors would do well purchasing either company. But let's take a look at their valuations in order to get a sense of whether one is a better buy.

Valuation Metric

Facebook

Alphabet

P/E

28.5*

29.8*

P/S

12.85

6.73

EV/EBITDA

19.89

17.69

Data sources: YCharts and company quarterly reports. *Adjusted for impact of the Tax Cuts and Jobs Act in the fourth quarter.

Facebook and Alphabet have similar valuations based on their earnings, but the market is valuing Facebook's revenue at about twice as much as Alphabet's. Looking a bit more closely, that valuation for Facebook makes sense considering it produces significantly higher profit margins than Alphabet and it's growing revenue at a faster rate.

Facebook is expected to grow earnings at a quicker pace than Alphabet thanks to its faster revenue growth expectations and its higher margins. The uncertainty about the potential of Alphabet's moonshots like Waymo is likely very high, though, making it worth taking a chance on for investors that believe in autonomous vehicles. Facebook, however, is likely a better buy for most investors.

If you can afford it, I'd buy both.