Google rules the internet, nothing is illegal for google. Like it or not, Google will spy you wherever you are, wheter you are shiiting or surfing doesnt matter. All you can do is to live an internet free life, which I dont think is poossible for anyone...
In fact, everyone spying us, not just Google.
Our browsers collect info about our searching on the Internet, sites we visit also collect info about us, our Internet providers, company websites we visit etc.
Even offline companies do this, so I don't see any reason for surprise here, it's common knowledge and practice.
Ask Snowden how much our governments spying us and US government is on the top of it.
If we want to avoid spying only solution will be to come back in the stone age or live in the forest