China on Friday announced new rules to limit the power of computer programmes used to drive the choices of the country's consumers, who must instead be encouraged to use online culture to "spread positive energy".
The measures are part of a broader crackdown by Beijing on the tech sector and mega-apps including gaming, personal finance and ride-hailing.
Algorithms must not promote content "endangering national security, disrupting economic and social order or infringing on the legitimate rights and interests of others", according to the rules published by China's Cyberspace Administration.
Users must not be shown discriminatory prices based on their past behaviour and must have the option to turn off recommendations, the rules say.
Algorithms drive the success of the most popular e-commerce, social media and news apps used in China, including TikTok's Chinese twin Douyin and top online shopping platforms Taobao and JD.com.
They detect patterns in users' past purchases and viewing behaviour to push them toward new products and content tailored to their preferences.
But app firms have faced criticism for allowing their algorithms to promote content that is illegal or deemed by state censors to be inappropriate.
The programmes should not induce "bad habits" in minors and must not push them to be "addicted to the internet:".
Instead they should "actively spread positive energy" and "adhere to mainstream values", the new rules say.
While China's largest social media platforms are often subject to censorship of politically sensitive posts, other undesirable content including gambling-related and sexual posts has been able to slip under the radar.
China has cracked down in recent years on online services deemed to pose a danger to its social fabric, implementing curfews for underage phone gamers and pushing video streaming sites to cancel "unhealthy" idol shows.Beijing has also in the past few months stepped up controls on its tech sector, ordering tightened protections for delivery app drivers and fining its largest shopping and music streaming apps for monopolistic behaviour.