Facebook (FB) has been sampling user activity to shape its production and acquisition strategy, spying on its peers' users, to tune into social media trends and gain a competitive edge over rivals.

According to the Wall Street Journal, Facebook knew that its rival Snap's (SNAP) flagship app Snapchat was struggling to attract new users way before the Venice, Los Angeles-based company came clean about its difficulties in its second quarter earnings report. People familiar with the matter told the Journal that the social network was aware that Snapchat user numbers fell off around the same time that Facebook launched the very similar Stories feature on Instagram, giving the company greater impetus to continue mounting an attack on one of its biggest rivals. (See also: Snap Slides to New Lows on Disappointing Earnings and Slowing User Growth.)

Facebook has been privy to this kind of information ever since it acquired Israeli mobile-analytics company Onavo in 2013. Onavo’s app, which has been downloaded by millions of users, provides Facebook with data on what people do with their phones.

The Journal’s sources say that the social network has been using this data to shape its product and acquisition strategy, including the $22 billion purchase of WhatsApp in 2014. Onavo showed that the messaging app had been installed on 99 percent of android phones in Spain, giving Facebook reason to believe that entire countries used WhatsApp to communicate.

Onavo is also believed to have shaped Facebook's live-video strategy. The social network added a live-video feature to its main app in 2016 after discovering encouraging usage patterns on other live-video apps, such as Meerkat and Twitter (TWTR) Inc.'s Periscope.

A Facebook spokesperson told the Wall Street Journal that people are made aware about what information Onavo collects when they download it. "Websites and apps have used market-research services for years," the spokesman said, adding that the company also uses outside services to help it understand the market and improve services. (See also: Facebook Introduces Its Answer to YouTube, TV.)

Onavo’s data comes from Onavo Protect, a free mobile app designed to keep data safe. When Onavo Protect users open an app or a website their movements are logged in a database, giving Facebook the ability to determine which apps people use the most. Frequency and duration metrics are provided, together with the sex of the user and the country they are accessing the app from.

Alphabet Inc. (GOOGL) and Apple (AAPL) also have the technology in place to monitor how rivals' apps perform, reported the Journal. Both companies declined to comment on if and how they use this data.