It would apply only if the offender used the internet to collect private information on the victim of the crime, to traffic the victim, or collect or distribute obscene material or child pornography.

Law enforcement could use the information only to investigate sex-related crimes, kidnappings or human trafficking. The identifying information would be kept private except under a court order.

The bill still violates free speech protections, including the right to anonymous speech, said Janice Bellucci, an attorney and president of California Reform Sex Offender Laws. She also objected that the bill includes juveniles, a provision she said may ensnare curious teenagers.

Sacramento County Deputy District Attorney Sonia Satchell testified that the measure would help law enforcement officials track human trafficking, from the stalking of victims on social media to the marketing of prostitutes online.

"The entire industry is run digitally," she said. "We live in a world of emails, Snapchats, Facebooks, Twitters, Instagram and clouds."

Hueso said the bill finds a balance between protecting free speech and protecting public safety and voters' desires.

The American Civil Liberties Union and Electronic Frontier Foundation sued to block the original measure but dropped their opposition after Hueso made violations of reporting requirements misdemeanors punishable by no more than six months in jail.

A previous version of the bill would have made violations felonies that had the potential to send third-strike sex offenders to prison for life, said Natasha Minsker, director of the ACLU of California Center for Advocacy & Policy in Sacramento.

"Given that what we're talking about is failing to hand over an email address, a much more appropriate consequence," she said.

The reporting requirements have been on hold since the lawsuit was filed in 2013. But other provisions of Proposition 35 remain in effect, including increased prison sentences for human trafficking.