Google's YouTube will pay $170 million to settle allegations by the Federal Trade Commission and the New York attorney general that it earned millions by illegally collecting personal information from children without their parents' consent.

The settlement, announced Wednesday, was passed in a 3-2 vote by the commissioners along party lines. The two Democrats voted against it, saying it did not go far enough to punish YouTube.

Shares of Google parent company Alphabet were up 1.1% at the end of trading Wednesday.

The settlement requires Google and YouTube to pay $136 million to the FTC and $34 million to New York for allegedly violating the Children's Online Privacy Protection Act. The $136 million penalty is the largest amount the FTC has ever obtained in a COPPA case since Congress enacted the law in 1998, according to the agency.

"YouTube touted its popularity with children to prospective corporate clients," wrote FTC Chairman Joe Simons, who voted in favor of the settlement. "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."

The COPPA rule requires child-directed sites to disclose data practices and get parental consent for collecting information on children under age 13. The complaint alleged that YouTube collected personal information from "viewers of child-directed channels" without parental consent using cookies, which track user behavior across the internet.

"Google and YouTube knowingly and illegally monitored, tracked, and served targeted ads to young children just to keep advertising dollars rolling in," New York Attorney General Letitia James said in a statement following the announcement. "These companies put children at risk and abused their power, which is why we are imposing major reforms to their practices and making them pay one of the largest settlements for a privacy matter in U.S. history."

YouTube marketed itself to Mattel and Hasbro as the "leader" in reaching children ages 6-11, the ruling found. Yet, in one instance, the company told an advertising company that it did not have users younger than 13 on its platform and therefore channels on its platform did not need to comply with COPPA.

In a blog post Wednesday, YouTube said it is taking steps to address the concerns raised over its practices.

"From its earliest days, YouTube has been a site for people over 13, but with a boom in family content and the rise of shared devices, the likelihood of children watching without supervision has increased," it said. In four months, YouTube added, it will restrict data collection on videos directed at children to "treat data from anyone watching children's content on YouTube as coming from a child, regardless of the age of the user."

YouTube said it will completely stop serving personalized ads on child-focused content and will disable comments and notifications on those videos as well. Creators will be responsible for identifying whether their content is made for kids, but YouTube said it will also use machine learning "to find videos that clearly target young audiences."

In its post, YouTube recommended parents use its separate app, YouTube Kids, to let children under 13 watch on their own. YouTube said it will be promoting the app more heavily across its services and is creating a $100 million fund to be disbursed over three years to create new children's content on both YouTube and YouTube Kids.

In addition to the penalty, the settlement requires Google and YouTube to "develop, implement, and maintain a system that permits channel owners to identify their child-directed content on the YouTube platform" so that YouTube can ensure it is complying with COPPA. It also requires them to provide notice about their data collection practices and "obtain verifiable parental consent" before collecting personal information from children.