On Netlifly [↗], you can inject scripts like CSS and JS into your production app. This means for example, instead of having your Google Analytics script in the development/local version of your website, you can leave that out for Netlify to add in production.
![Netlify snippet injection image [→]](../images/netlify-snippet.png)
This means your local use of the site won't be captured in analytics.
How to inject snippets on Netlifly
Follow the steps below to add a snippet to your site on Netlify.
- Select your site on Netlify.
- Head over to the Site settings page.
- Select Build & deploy > Post processing from the left hand menu.
- Click on Add snippet from the Post processing > Snippet injection section
The Snippet form lets you specify where the script goes on your page. Either in the head or body.
You'll also need to give your script a name.
Also, remember your script will be pasted directly into the page, so put the script tag around it before saving, e.g. < script > script >, < style > style >
What can go wrong?
A script won't show up if there are no head or body tags in your page's markup (HTML). Make sure all pages have the required tag.