When I view the page source of my website, I can see my Google Analytics snippet:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-12367889-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-12367889-1');
gtag('config', 'AW-608708765');
</script>
I tried pasting this code into a local file and opening that file in a browser. Google Analytics counted the hit that wasn't from my website.
That means everyone can copy my code and use for fake traffic. How can I prevent that?