Google has agreed to a $391.5 million settlement with 40 states in connection with an investigation into how the company tracked users' locations, state attorneys general announced Monday, calling it the largest multistate privacy settlement in U.S history.