On 27 September, Donald Trump and Hillary Clinton faced up to one another in the first of the televised presidential debates. Most observers concluded that Clinton had come off best. She was better prepared, they thought, and towards the end Trump seemed rattled and rambling.

Needless to say, this didn’t stop the Trump campaign team from using the phrase “Trump Won” in ads even before the debate ended. Aha, you say, that’s American politics for you: you get what you pay for. And in these circumstances, every candidate says that she or he has won anyway, no matter what happened in the debate.

But then something interesting happened. The hashtag #TrumpWon went viral on Twitter and in a few hours had reached the top of the global trending list. Trump was on to it like a shot. “The #1 trend on Twitter right now,” he tweeted, “is #TrumpWon – thank you!”

The plot then began to thicken. A Twitter user called @DustinGiebel posted a tweet showing a map of Russia centred on St Petersburg under the heading “The #TrumpWon hashtag starting location, that’s interesting”. The clear implication was that the hashtag began in St Petersburg and so – nudge, nudge, wink, wink – constituted yet another confirmation that Trump has supporters in Russia, possibly even linked to Vladimir Putin.

The person who tweeted the map said he’d spotted it on TrendsMap.com, a service that tracks trending topics on Twitter. So I went to the site but couldn’t find the hashtag anywhere near St Petersburg. Neither could Philip Bump of the Washington Post; he checked with Trendsmap, which confirmed that the map in the original tweet wasn’t theirs. They also said that, according to their data, the hashtag had originated in the US.

At this point, Gilad Lotan, a data scientist who works at Betaworks, took up the trail. He researches ways in which people are hacking social networks in order to gain more of what has become the scarcest resource of all in our networked world – attention. He started by looking for the geographical areas where the hashtag #TrumpWon began trending. He found that it never showed up in any Russian location; instead, the growth began in Baltimore and Detroit, after which it very quickly jumped to “worldwide” status and stayed there for a few hours as it spread to Australia and the UK.

Normally, Lotan says, when a hashtag goes viral you see the trend jump from city to city before reaching countrywide or global status. But this didn’t happen with #TrumpWon. Instead, he reports, “there was a group of highly organised users who all posted the exact same message at around the same time, from (seemingly) different geographic locations. The exact same message was published by thousands of accounts, likely all over the world, a few hours after the debate had ended (between 3-5am UTC time).”

The tweet that did the trick read: “#TrumpWon the debate tonight! Let’s make America Great again. Add your name: bit.ly/2dfF4E4”. The link went straight to the Trump campaign website. Lotan then built a network graph of the Twitter users who were first to post to the hashtag. They clustered into four groups – #MAGA (for Make America Great Again), #Trump2016 1, #Trump2016 2 and #TGDN (a tag used by conservatives to identify each other).

This neat piece of network analysis is interesting for several reasons. The first is that it shows that you can never take anything that happens on social media at face value. So when mainstream journalists regard the fact that something is trending on Twitter or Facebook as being significant, one should take the reports with a large handful of salt.

The second is that social media of all kinds are now being “gamed” for political, commercial and other purposes. One of the interesting things about the #TrumpWon story, for example, is not only that it was gamed by Trump supporters, but that someone also attempted a counter-strike, seeking to undermine it by faking a Russian connection.

But perhaps the most important lesson to draw from the saga is that it highlights the skills one needs to unearth the truth about anything that happens online. Nick Tomalin, the great Sunday Times journalist who was killed in the Yom Kippur war, used to say: “The only qualities essential for real success in journalism are ratlike cunning, a plausible manner and a little literary ability.” To these we now need to add: a knack for network analysis.