I track many websites in Google Analytics. Recently I accidentally added tracking code for site A to site B, which I noticed a couple of weeks later. By then, one website had two weeks of no visitors, and the other website had tons of traffic, relative to the other.
It completely messed up my analytics data for the site, adding data for the other site.
This made me think, since it's easy to view the source of a site and its Google Analytics code, could somebody take that code and add it to their own site(s) and completely mess up my site's analytics data?
A lot of very big name websites use Google Analytics, I wonder why this hasn't been thought of or mitigated; wouldn't be too hard for Google to check if the source domain matches the site that it's meant to be tracking.
How can I mitigate against this?