In spite of extreme uncertainty brought on by COVID-19 and a less-than-optimistic outlook, both Shopify (SHOP -2.37%) and Facebook (META -0.52%) shareholders have had an exceptionally good year. As of this writing, the two stocks are up 155% and 27%, respectively, so far in 2020, compared to a 5% gain for the S&P 500.  

Over the long term, I think both of these technologists will continue their market-beating ways. Though both companies approach it from different angles, they are benefiting from higher digital engagement and a massive small business migration to the internet.

I think one is a more timely buy right now -- although I expect both stocks to do well in the next decade

A shopping cart full of boxes sitting on top of a computer.

Image source: Getty Images.

Shopify: High-growth e-commerce on steroids

As digital shopping continues its takeover of the retail industry, Shopify was already in growth mode. During the first quarter of 2020, revenue grew 47% year over year to $470 million. But with the pandemic response shutting down large swathes of the economy, the spring quarter was expected to be a rough one with Shopify's more than 1 million merchants being deeply impacted by the lockdown.  

Just the opposite happened. No doubt helped by federal stimulus money and consumer spending making a massive shift to online, Shopify's revenue in Q2 surged 97% higher to $714 million. Gross merchandise value sold on the Shopify platform was the star, growing 119% from a year ago to $30.1 billion. The bottom line also swung to a $36.0 million profit compared with a $28.7 million loss a year ago. That swing goes a long way to explaining the boom in Shopify's share price this year, as the company's big market potential (the company estimates it took 5.9% of U.S. retail e-commerce, second to Amazon's 37.3% share) starts to translate into profitable return.

Shopify's Q2 revenue surge isn't likely to last beyond 2020, but it seems equally unlikely consumers will simply go back to the way they shopped pre-pandemic once COVID-19 has been beaten. In part, I think this is so because businesses themselves are moving online too, and the internet is helping thousands of people start their own businesses. Shopify said new online store creation using its software went up 71% compared to the first quarter alone. Not all of the stores will survive, as getting a new enterprise off the ground can be brutal. But if ever there was a time to make the jump, doing it now during perhaps the single-largest shift in consumer behavior ever is it.  

Shopify has scored other big wins in recent months as well, like adding the ability to integrate its users' stores on Walmart's Marketplace and handling some of the software development work for Facebook Shops. Shopify has momentum going for it, but that comes at an extremely steep price -- 57 times trailing 12-month sales and 47 times expected 2020 sales to be exact. But with a market cap of just over $120 billion, it isn't hard to imagine this e-commerce technology firm being even larger than it is now in another decade.

Facebook: Social media as a platform

And then there's Facebook, which was also expected to take a substantial hit during Q2 because virtually all of the social media leader's revenue is derived from advertising. The reasoning went like this: When recession hits, consumer spending falls, which reduces the effectiveness of marketing -- and many businesses pause on their ad efforts as a result. This scenario did play out to some extent. Facebook's revenue growth of 18% year over year in Q1 2020 slowed to "only" 11% in Q2, to $18.7 billion.

For such a large business navigating unprecedented times, it's a more than respectable figure. Ad spending did in fact take a hit, but not as much as expected as small businesses (from which Facebook relies on heavily for ad spending) upping their online presence saved the day. Plus, social media user engagement skyrocketed with many people stuck at home during the spring, and "family monthly active people" (a user of Facebook, Instagram, WhatsApp, or Messenger) increased 14% to 3.14 billion. Again, this growth will moderate going forward, but ad spending will rebound too. Put simply, Facebook's social media growth story is far from over.  

But there's a lot more going on at Facebook than ads. There's the Oculus virtual reality business that made up the majority of "other" revenue -- which grew 40% to $366 million and was nearly 2% of the total. And Facebook's family of social apps have been building new capabilities targeting e-commerce and small business services. Facebook Shops could deepen the company's relationship with small merchants. WhatsApp Pay is testing in India as part of a larger money transfer and digital payments strategy, and $5.8 billion was also invested in Indian e-commerce giant Jio Platforms. And other tools and messaging apps for businesses to connect with customers are being developed to help bring big e-commerce to a more localized level.

Given the massive size of Facebook's user base, it's hard not to get excited about the tech giant's ability to deepen its presence in the global economic ecosystem. And with operating profit margins floating around the 40% mark since it made its public debut in 2012, and a massive $58 billion cash and equivalent war chest, Facebook stock currently trading for 32 times trailing 12-month earnings is a fair price in my book.

I own both Shopify and Facebook stock, but at this juncture, I think Facebook is the better buy given Shopify's sky-high valuation.