It's because phones have a special tracking id built into the phones. The tracking ID is used for things like advertising. It's logs everything and then sends it to the Google servers then makes a special ad for you based on what it has logged.
It's illegal but you can't prove they do it so it's fair game to google.