The new regime will attempt to give consumers more control over their data.
It will also “help small businesses thrive, and ensure news outlets are not forced out by bigger rivals,” according to the government.
“There is growing consensus in the UK and abroad that the concentration of power among a small number of tech companies is curtailing the growth of the sector, reducing innovation and having negative impacts on the people and businesses that rely on them,” said Digital Secretary Oliver Dowden, in a statement.
“It’s time to address that and unleash a new age of tech growth.”
The new code will set clear expectations for the most powerful firms over what represents acceptable behaviour when interacting with competitors and users.
Platforms that are funded by digital advertising could be required to be more transparent about the services they provide and how they are using consumers’ data.
They will be expected to give consumers a choice over whether to receive personalized advertising and prevented them from placing restrictions on their customers that make it hard for them to use rival platforms.
The code will be enforced by a new dedicated unit within the CMA.
The Digital Markets Unit could be given powers to suspend, block, and reverse decisions made by technology firms and to impose financial penalties for non-compliance.
Google and Facebook have previously said they are committed to working with the British government and regulator on digital advertising.
The new code could also affect the media industry, which has lost much of its advertising revenues to Facebook and Google.
The new code will attempt to govern commercial arrangements between publishers and platforms to help keep publishers in the business.
It will try to stop online platforms from imposing unfair terms on news publishers that limit their ability to monetize their content.