Human behaviour is thought to spread through face-to-face social networks, but it is difficult to identify social influence effects in observational studies 9–13, and it is unknown whether online social networks operate in the same way 14–19. Here we report results from a randomized...