Installing the Wrapper Tag
Paste the wrapper tag into the <head> of your site. Place it as high as possible so the library and config can load in parallel with the rest of the page.
Where to install
The tag is a single inline <script> block. Put it in <head>, before other ad-related scripts:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Your Site</title>
<!-- Anima wrapper — paste the tag you copied from Setup → Wrapper here -->
<script>
/* inline loader from the portal */
</script>
<!-- Other scripts below -->
</head>
The inline loader fires the library-load and config-fetch requests as early as possible. Placing it early in <head> means the library and config can arrive before the first ad slot element is rendered.
Installation by platform
WordPress
Theme editor
- Appearance → Theme Editor
- Open
header.php - Paste the tag immediately after
<head> - Save
Header-scripts plugin (recommended)
- Install any "insert headers and footers" plugin
- Paste the tag into the plugin's "Header" / "scripts in head" field
- Save
Theme functions
// functions.php
function add_anima_wrapper() {
// Paste the entire <script>…</script> block here, verbatim.
?>
<script>/* inline loader from the portal */</script>
<?php
}
add_action('wp_head', 'add_anima_wrapper', 1);
Webflow
- Project Settings → Custom Code
- Paste the tag into Head Code
- Save and publish
Squarespace
- Settings → Advanced → Code Injection
- Paste the tag into Header
- Save
Shopify
- Online Store → Themes → Actions → Edit Code
- Open
theme.liquid - Paste the tag immediately after
<head> - Save
Next.js (App Router)
The wrapper tag is inline JS that must execute on every page render. Put it in the root layout.tsx:
// app/layout.tsx
import Script from 'next/script';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<head>
<Script id="anima-wrapper" strategy="beforeInteractive">
{`/* inline loader from the portal, without surrounding <script> tags */`}
</Script>
</head>
<body>{children}</body>
</html>
);
}
Strip the outer <script> / </script> from the tag you copy — Next's <Script> wraps its contents in its own tag.
Gatsby
// gatsby-ssr.js
import React from 'react';
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<script
key="anima-wrapper"
dangerouslySetInnerHTML={{
__html: `/* inline loader from the portal, without surrounding <script> tags */`,
}}
/>,
]);
};
Static HTML
Paste the tag into every page template's <head>, or into whatever include or partial is shared across pages.
Installation checklist
Before deploying:
- Tag is in
<head>, not<body> - Tag is near the top of
<head>, before other ad-related scripts - Tag was copied verbatim — the
domain_idand npm org values inside it came from the portal, not hand-typed - Your site serves over HTTPS (the loader fetches over HTTPS; mixed-content pages will fail)
Deploying
After pasting the tag:
| Platform | Deploy |
|---|---|
| WordPress | Save the file / plugin; clear any full-page cache |
| Webflow | Publish |
| Squarespace | Save (auto-publishes) |
| Static / Jamstack | Deploy to your host |
| Custom | Your CI/CD |
CDN and full-page caches will keep serving old HTML until invalidated. Purge your edge cache after deploying the tag.
Testing before production
Two options:
Staging. If you have a staging copy of your site, install the tag there first and confirm it loads (see Verifying installation). The same tag works on staging and production unless you've been given separate domain IDs.
Preview with debug mode. On any page with the tag installed, append ?pbjs_debug=true to the URL. The wrapper logs an AAM badge in Console and you can inspect window.Wrapp, window.__wrapp_loader, and window.wrapperTag. See Wrapper Debugging for the full signal list.
Next
Troubleshooting
Tag isn't in the rendered HTML
| Cause | Fix |
|---|---|
| Full-page cache still serving old HTML | Purge CDN / full-page cache |
| Deployment not complete | Confirm the deploy ran |
| Wrong template | Paste into a template included on every page |
JavaScript errors in Console
| Symptom | Fix |
|---|---|
Failed to load resource on the jsDelivr URL | Confirm your domain ID in the tag matches what's in the portal |
Mixed content warnings | Serve your site over HTTPS |
| Errors unrelated to the wrapper | Usually a conflicting analytics or consent script — check the stack trace |
Common questions
Do I need the tag on every page?
Yes. The tag has to be in <head> of any page where ads should serve. Put it in the shared template / partial / layout.
Will it slow down my site?
The inline loader is tiny (~1.5 KB) and kicks off the library load and config fetch in parallel, both at low priority (priority: 'low') to avoid contending with LCP-critical resources. In practice the impact on first paint is negligible. See Revenue vs. latency for how to measure the tradeoffs.
Can I install on a subdomain?
Each subdomain needs its own domain record in Anima. If the subdomain isn't listed in your Account sidebar's account selector, ask your account manager to add it.