<head> or at the end of the
Most analytics providers, retargeting services, and A/B testing services will give you an HTML snippet and ask you to add it to every page on your site. Netlify lets you do this without having to pollute the source code for the site with production specific analytics snippets.
You can pick between injecting the scripts before the closing
</head> tag or before the closing
Injected snippets will also show up on the
password protection screen. This means you can verify that your analytics scripts are correctly configured without having to remove the password when your site is still under development.
Snippet injection UI
In Site settings > Build & Deploy > Post processing, find the Snippet Injection section and click Add Snippet. Then give your script a name and paste the script body (including any
<script> tags, etc).
You can use the API to get snippets, add snippets, and more.
Did you find this doc useful?
Your feedback helps us improve our docs.