Last Reviewed by Netlify Support May 2024
Especially useful if you are running split tests, or want to be sure that you are only viewing analytics data related to you production branch, with Snippet Injection, you can modify the analytics code injected into each page of your site.
Snippet injection is configurable in your site’s deploy settings and give access to environment variable including things like the active branch for that build.
https://app.netlify.com/sites/{YOUR_SITE}/settings/deploys#snippet-injection
The video below (~5 mins) walks through setting this up.