Global scripts
Inject HEAD / BODY_START / BODY_END scripts site-wide. Per-deployment.
Global scripts are snippets of HTML or JavaScript that Autonnel injects into every storefront page served by your deployment. Each deployment’s scripts are stored independently. You manage them from Settings → Scripts.
Injection positions
Each script is assigned one of three positions:
| Position | Where it is injected |
|---|---|
HEAD | Inside the <head> element, after meta tags |
BODY_START | Immediately after the opening <body> tag |
BODY_END | Immediately before the closing </body> tag |
Scripts within the same position are injected in the order shown. You can reorder them by dragging rows in the settings table.
Adding a script
- Go to Settings → Scripts.
- Click Add script.
- Enter a name (used only in the admin list — not rendered to the page).
- Select a position from the dropdown.
- Paste your script content. This should be a complete
<script>tag or a<noscript>fallback block, not bare JavaScript. - Click Save.
The script is enabled by default. You can disable a script without deleting it by toggling the Enabled switch.
Common use cases
Site-wide analytics
Paste your Google Analytics, Plausible, or Mixpanel loader into the HEAD position:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Advertising pixels
Paste a Meta Pixel base code or TikTok Pixel base code into HEAD or BODY_START. The pixel fires on every page load. Per-funnel event-specific pixels (Purchase, AddToCart) are configured separately in Funnel → Ads, not here.
Custom interaction JavaScript
If you need a script to run after the DOM is ready, use BODY_END:
<script>
document.addEventListener('DOMContentLoaded', function () {
// your code
});
</script>
Script ordering relative to funnel scripts
Funnel scripts (configured per funnel in Funnel → Scripts) are injected after site-level scripts within the same position. The full injection order for a given position is:
- Site global scripts (this page), ordered by their
orderfield - Funnel scripts for the current funnel, ordered by their
orderfield
This means a site-level Meta Pixel base code in HEAD always loads before a funnel-specific Meta Pixel event script in HEAD.
Caveats
- Scripts in the
HEADposition are render-blocking by default. Use theasyncordeferattribute on<script>tags unless the script explicitly requires synchronous execution. - A script that throws a JavaScript error in
BODY_STARTcan block subsequent scripts in that position. Test scripts in isolation before enabling them site-wide. - Global scripts run on every storefront page — landing pages, checkout, upsell, thank-you, and error pages. If a script should only run on specific page types, use a funnel script instead, or add a conditional check inside the script content.
- Conflicts between site-level and funnel-level pixels can cause double-fires. If you have a Meta Pixel in both global scripts and a funnel script, verify that one fires the base code and the other fires only the event, not both.
Related
- Funnel scripts — per-funnel script injection
- Branding — other deployment-level settings