Internet users who have browsed the web in Google's Incognito mode may have had a less private experience than they expected.

The search engine has been accused of illegally invading the privacy of its users by collecting information about what they are viewing when the function is switched on.

Incognito mode gives users the ability to use the browser without their activity being saved to their device.

This means websites visited will not be stored and accessible in the user's search history.

Watch: How to delete your data from Google

However, the function does allow websites visited to track a person's usage with tools such as Google Analytics and Google Ad Manager.

A class action suit was filed against the search engine and its parent company Alphabet in the US on Tuesday for at least $5 billion.

The complaint said Google gathers data through applications and website plug-ins, including smartphone apps, regardless of whether users click on Google-supported ads.

This allows Google to access the “most intimate and potentially embarrassing things” users may search for online, it said.

It says Google "cannot continue to engage in the covert and unauthorized data collection from virtually every American with a computer or phone".

Meanwhile, Google says it is transparent about the data it's collecting when this mode is switched on.

A spokesman for Google, Jose Castaneda, said: "As we clearly state each time you open a new incognito tab, websites might be able to collect information about your browsing activity". It denies the data collection is illegal.