They're both. They're selling a service to consumers, which they buy with their personal data. They then use that data to sell to advertisers in the form of better targeted ads.
They didn't even run ads for the first three years of their existence.