Some time ago, my web and Facebook pages started filling with adverts about funeral arrangements and what I could do with £1 million pounds (I should be so lucky). I wasn't planning on dying any time soon, so this was a little creepy. Did the evil algorithms know something about me that I didn’t? Had Big Data called time on me?

Now, like everyone, I'm used to finding that after I've purchased (say) a pair of walking boots online, that for months afterwards every page seems to be adorned with glossy ads for exactly the ones I've already bought. Why they do this mystifies me. But I have never searched Google or Amazon for coffins, and nor did I ask it or Facebook what I could do with a million bucks. So what was going on here?

READ MORE: 'Facebook should be regulated like the BBC' SNP's top MP on digital and media calls for crackdown in wake of Cambridge Analytica scandal

Well, as it happened, I had been conducting a lengthy email conversation with a bereaved friend. I had also been exchanging emails with the tax expert, Professor Richard Murphy, about Scottish Labour's plans to tax people who own £1million in property. Could some advertising algorithm have picked this up from my private email and sold the data to funeral arrangers and financial advisers? Surely not. That would be an astonishing invasion of privacy.

I've since learned that people with a Gmail account had been allowing Google to scan the content of your emails for advertising purposes. I don’t have a Gmail account, but many people I correspond with do. Could Google have been harvesting my data indirectly? Is this paranoia? Probably. But like most of us, I'm only dimly aware of how data-mining works, and what I do know is that companies that use it are not to be trusted.

Brendan O'Hara: The days of the digital 'Wild West' are numbered ... regulation is on its way

The revelations about how Facebook had been harvesting data on an industrial scale, and how firms like Cambridge Analytica had been using it to manipulate elections, are only the start. The extent of data-mining, by legions of tech firms, is so vast that it almost defies understanding. We know that Facebook holds 98 data points about each of us, including political outlook, purchasing history, hobbies, religion, location, age, gender etc. Google also collects data from billions of our searches on everything from herpes to Hollywood. In the era of Big Data, this information can be cross-referenced with other data bases on credit rating, criminal history (even if you've never been prosecuted) and even online health records to generate an astonishingly detailed picture of every single one of us.

Facebook and Google apologists insist that it’s all our fault because we've been giving permission for these companies to harvest our data and that of our friends. You should've read the small print, dummies! But this is exactly the same excuse used by crooks in the financial services industry when they mis-sold payment protection insurance, endowment mortgages, private pensions, precipice bonds and all the other scams they pushed before the crash (and in many cases still do). It is the morality of the confidence trickster throughout the ages.

READ MORE: Cambridge Analytica's world wide web: a story of data, democracy and dirty tricks

Government agencies and security services have also been collecting vast silos of data about us through tax records and email metadata etc. Indeed, with the advent of Artificial Intelligence, which will have access to this cornucopia of confidential information, we could be in the throws of an entirely new form of surveillance state. Already, police and prosecutors are using Big Data to determine our propensity to commit crime – its called “predictive policing”. Facebook has been investing heavily in AI and deep learning.

We clearly need a New Deal on data. Following the Facebook/Analytica scandal the government has promised to act, and there are legitimate demands for the giant tech companies to be regulated. Facebook, one of the richest companies on the planet, has destroyed its reputation for straight dealing by dodgy data mining practices. It used to be a benign social network, but somewhere down the line Facebook turned into a greedy, unscrupulous, share price-obsessed corporation selling our souls to the highest bidder, whether that be insurance companies or the Donald Trump campaign.

As with the banks before 2007, immense wealth has rotted the moral integrity of the internet behemoths to such an extent that people like Mark Zuckerberg of Facebook don't seem even to comprehend the nature of the problem. He still thinks he's just a college geek helping the world become more connected. In fact, he has constructed a sinister digital monopoly, helped pollute the sources of public information and facilitated manipulation of the civic sphere by dark interests.

READ MORE: 'I'm convinced Cambridge Analytica interfered in the EU referendum', says SNP MP probing fake news scandal

There is a strong case for the behemoths to be broken up by new anti-trust laws fit for the 21st Century. Facebook, Google and Amazon are the robber barons of the digital age, and use their immense wealth and market power to lock out competition. In a previous generation, the break up of the telecoms monopolies in the 1980s helped create the internet itself. These firms should be regarded as public utilities and regulated as such.

There must be a presumption of transparency. Tech companies relied on our ignorance about their business model to manipulate our data on an industrial scale. Their right to 'monetise', ie cash in on it, could be curbed by giving the users the copyright of any data posted on the web. The laws on political campaigning need to be redrawn so that it becomes illegal to use personal information in campaigns unless voters are directly informed about it. The idea that voters could be targeted for propaganda on the basis of data scraped from their Facebook pages is so Orwellian that people in future will be astonished that we let it happen.

To deal with fake news, abuse, lies and other misuses, companies like Twitter and Facebook should be regarded, not as neutral technology companies, but publishers and should be regulated like newspapers, and, in the case of YouTube, like broadcasters. Facebook and Twitter are among the biggest publishers on the planet. The fact that they don’t generate the content they publish is irrelevant. The myth that they are neutral platforms, like a telephone company, has allowed them to abdicate all responsibility for the material published and disseminated on their websites.

READ MORE: 'Facebook should be regulated like the BBC' SNP's top MP on digital and media calls for crackdown in wake of Cambridge Analytica scandal

However, we need to be careful that, in the process of reigning in the web behemoths, we don't allow governments to take over the entire apparatus of surveillance and control. Nor do we want it used as a pretext for further restrictions on freedom of speech and yet more categories of thought crime. But this newspaper is regulated by the law without there being any editorial interference - and monopolies don’t promote free speech. We are at a very delicate moment in human history, and how the internet is regulated could determine how we live, and even how we think, in the new digital age. However, change must come.

Regulation could cripple internet companies, or force them to downsize, but that might be no bad thing. They have become a cancer on the information society. We need to dial back the internet to the days before it became corporate, when there were a multiplicity of social networks and search companies, many of them operating on open source basis. Facebook has poisoned the well. If it can't reform it doesn't deserve to survive.