Google (GOOGL - Get Report) on Wednesday agreed to pay a record $170 million fine and to make changes to protect children's privacy on its YouTube video site to settle charges with regulators that the company had illegally collected personal data from children and used it to target them with advertising.

In a settlement with the Federal Trade Commission and New York's attorney general, regulators said on Wednesday that YouTube had violated a federal children's privacy law known as the Children's Online Privacy Protection Act, or COPPA.

Regulators said YouTube, which is owned by Google, had illegally gathered childrens' data -- including so-called cookies and other embedded coding that tracks web browsing -- without their parents' consent. It also charged that the company made millions by incorrectly marketing the age-category to advertisers as over-13 when no such restrictions were in place. 

Check out this infographic on major privacy judgments against Google: pic.twitter.com/LfM9CG2oVp

— FTC (@FTC) September 4, 2019

"YouTube touted its popularity with children to prospective corporate clients," FTC Chairman Joe Simons said in a statement. "Yet when it came to complying with COPPA, the company refused to acknowledge that portions of its platform were clearly directed to kids. There's no excuse for YouTube's violations of the law."

YouTube agreed to pay $170 million, of which $136 million will go to the FTC and $34 million to New York. The sum represents the largest civil penalty ever obtained by the FTC in a children's privacy case, dwarfing the previous record fine of $5.7 million that the agency levied this year against video-sharing app TikTok, which is owned by privately held Chinese tech company ByteDance. 

Shares of Google parent Alphabet opened up 0.79% at $1,178.80 in early trading on Wednesday.

Alphabet is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells GOOGL? Learn more now.