Struggling social media company gets a badly needed boost in growth, while its losses narrowed