Branch specific environment variables on Netlify

We’re using Netlify’s automatic deployment for all pushed git branches for git certification projects.

We want to include our analytics scripts (et al) only for the master branch, i.e. the version of the website that our users are visiting.

It’s possible to build environment variables on Netlify, but I don’t get if it’s possible to differentiate variables for certain branches?

You can setup context specific build variables in your netlify.toml

[context.production.environment]
API_ENDPOINT = "https://production.yourservice.net"

[context.staging.environment]
API_ENDPOINT = "https://staging.yourservice.net"`

More info in this support guide: