Skip to content

Installing Appzi

To make Appzi work on your site, the portal identifier must be specified.

The Appzi script (found under Portal Settings) must be included on every page where you want the survey to appear using a simple <script src="..."> tag.

You can place it traditionally in either the <head> or just before the closing </body> tag.

<html>
<head>
<!-- ..other scripts.. -->
<script async src="https://w.appzi.io/w.js?token=PORTAL_TOKEN"></script>
</head>
<body>
<h1>My Fantastic site</h1>
<!-- Your page content -->
</body>
</html>

Do not omit the token parameter from the URL — it’s required to load the correct configuration. The Appzi survey is distributed HTTPS-only, so protocol relative urls like <script src="//w.appz... will not work.

This method is suitable if you prefer not to modify the page directly and are using a script manager like Google Tag Manager.

(function injectAppziScript(document) {
const script = document.createElement("script");
script.src = "https://w.appzi.io/w.js?token=PORTAL_TOKEN";
script.async = true;
document.head.appendChild(script);
})(document);

This option is recommended if you want to configure additional features using the window.appziSettings object. The Appzi bundle loads only once, so make sure the settings object is defined before loading the Appzi script.

<html>
<head>
<script>
window.appziSettings = {
portal: "PORTAL_TOKEN",
data: {
// ...
},
};
</script>
</head>
<body>
<h1>My Fantastic site</h1>
<!-- Your page content -->
<script async src="https://w.appzi.io/w.js"></script>
</body>
</html>

Your portal token can be found in the Appzi Portal:

  1. Log in to portal.appzi.com
  2. Select your portal from the dashboard
  3. Navigate to SettingsPortal Settings
  4. Copy the token from the “Installation Code” section

Replace PORTAL_TOKEN in the examples above with your actual portal token.

After adding the Appzi script to your site, verify it’s working:

  1. Open your website in a browser
  2. Open the browser’s Developer Console (press F12)
  3. Type appzi in the console and press Enter
  4. You should see an object with methods like openSurvey

If you see undefined, check that:

  • The script tag is present in your HTML
  • The token parameter is correct
  • There are no JavaScript errors in the console
  • Your site’s Content Security Policy (CSP) isn’t blocking the script (see CSP Configuration)

For client-side frameworks without server-side rendering (Create React App, Vue CLI, Angular), add Appzi using one of these approaches:

Add the script to your public/index.html:

<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://w.appzi.io/w.js?token=PORTAL_TOKEN"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>

Or load it dynamically in your component:

import { useEffect } from 'react';
function App() {
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://w.appzi.io/w.js?token=PORTAL_TOKEN';
script.async = true;
document.head.appendChild(script);
}, []);
return <div>Your App</div>;
}

Appzi is a client-side library and does not support server-side rendering. When using SSR frameworks, you must ensure Appzi only loads on the client side to avoid errors and hydration mismatches.

App Router - Use client components:

app/components/AppziScript.tsx
'use client';
import { useEffect } from 'react';
export default function AppziScript() {
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://w.appzi.io/w.js?token=PORTAL_TOKEN';
script.async = true;
document.head.appendChild(script);
}, []);
return null;
}
// app/layout.tsx
import AppziScript from './components/AppziScript';
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<AppziScript />
</body>
</html>
);
}

Pages Router - Add to _document.js:

import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() {
return (
<Html>
<Head>
<script
async
src="https://w.appzi.io/w.js?token=PORTAL_TOKEN"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}

Self-hosted Appzi bundles are available upon request. Please 📧 reach out for details.