Google agreed on Wednesday to pay a record $170 million fine and make changes to protect children’s privacy on YouTube, as regulators said the video site had knowingly and illegally harvested personal information from children and used it to profit by targeting them with ads.

Critics denounced the agreement, dismissing the fine as paltry and the required changes as inadequate for protecting children’s privacy.

The penalty and changes were part of a settlement with the Federal Trade Commission and New York’s attorney general, which had accused YouTube of violating the federal Children’s Online Privacy Protection Act, or COPPA.

Regulators said that YouTube, which is owned by Google, had illegally gathered children’s data — including identification codes used to track web browsing over time — without their parents’ consent.