---
title: Install with a script tag or Google Tag Manager
slug: install-script-tag
description: Install Personizely on any website with one script tag in the head or with Google Tag Manager: where to paste it, async vs sync, SPAs and checks.
docTags: 
createdAt: 2026-10-16T19:35:12.140Z
---

On any website without a native Personizely integration, such as BigCommerce, Magento, Squarespace or a custom-built site, you install Personizely by adding one script tag to the `<head>` of every page. You can also add it through Google Tag Manager, with some trade-offs for A/B tests.

**Available on:** any website that lets you add a script to the `<head>`.

## Get your snippet

1. In Personizely, go to **Settings → Website**.
2. Copy the code from the **Code** block. It looks like this, with your own website key:

```html
<script src="https://static.personizely.net/YOUR_WEBSITE_KEY.js" type="text/javascript" async></script>
```

The `async` attribute is present when **Settings → Tracking → Asynchronous script loading** is on (the default). Agencies using white label get a snippet on their own host; always copy it from the app.

If someone else manages your site, click **Email your developer** to send them the code and instructions.

## Add it to your site

1. Paste the snippet **just before the closing `</head>` tag** on every page, or as high in the `<head>` as you can if you load it synchronously.
2. Put it in your site's shared layout or header template, so every page gets it, including landing pages and the order confirmation page.
3. Publish or deploy the change.

Where that template lives depends on your platform:

| Platform                 | Where to paste                                                                                |
| ------------------------ | --------------------------------------------------------------------------------------------- |
| BigCommerce              | Storefront → Script Manager: new script, placement **Head**, all pages                        |
| Magento / Adobe Commerce | Content → Design → Configuration → your store view → HTML Head → **Scripts and Style Sheets** |
| Squarespace              | Settings → Advanced → Code Injection → **Header** (needs a plan with code injection)          |
| Custom site or framework | Your base HTML template or root layout component                                              |

For help with other platforms, see the platform guides in the [help center](https://help.personizely.net).

## Choose async or sync loading

| Mode                   | Snippet     | Page rendering                     | Best for                                           |
| ---------------------- | ----------- | ---------------------------------- | -------------------------------------------------- |
| Asynchronous (default) | Has `async` | Never waits for Personizely        | Popups and widgets, personalization below the fold |
| Synchronous            | No `async`  | Waits until the snippet has loaded | A/B tests of page content, split URL tests         |

When you change **Asynchronous script loading** in **Settings → Tracking**, copy the updated snippet to your site again, because the change is in your HTML. The first time you start a campaign on an async site, Personizely offers to switch you to synchronous loading ("Prevent flicker on your site?"). See [Performance and flicker](docId\:sgD1BsYNMvpjqHqp_qcdi).

## Install with Google Tag Manager

1. In GTM, create a **Custom HTML** tag and paste the snippet.
2. Set the trigger to **Initialization - All Pages** (or **All Pages**).
3. Preview, then publish the container.

**Check code** in Personizely detects snippets added through a tag manager.

:::hint{type="warning"}
A tag manager always adds the snippet after the page has started loading, whatever the `async` setting. Popups and widgets work normally, but content A/B tests and split URL tests can show the original page briefly before the variation. For those tests, add the script tag directly to your `<head>` instead.
:::

## Track purchases and conversions

Without a platform integration, Personizely doesn't receive orders directly. Use one or more of:

- **The [Google Analytics 4 and GTM](docId\:NwHWpmwoIntBLz7-PTe3q).** If your site pushes GA4 ecommerce events (`purchase`, `begin_checkout`, `add_to_cart`) to the `dataLayer`, Personizely records them as purchases, checkout starts and add to carts, with their value. Purchases are de-duplicated by transaction ID.
- **[Goals](docId\:XSkE1LjM1yiNhLBzpr1B1)** based on page views (such as `/order-confirmation`), clicks, form submits, scroll or time.
- **The [JavaScript API (window.ply)](docId\:d64TegyOiwNA2GFG1eXPm)**: `ply.trackEvent()` and `ply.trackGoal()`.

## Single-page apps

You only need to load the snippet once. It detects route changes made with the History API (as in React, Vue, Next.js and similar apps), and treats each one as a new page view, re-checking targeting, campaigns and widgets. Changes to only the hash or query string aren't treated as a new page.

## Verify it works

1. Open your site in a normal browser window and open the developer console. You should see `Personizely initialized. Startup time: <n>ms`.
2. View the page source (or, for GTM, the Elements panel) and check that the script appears once.
3. In Personizely, click **Check code** in **Settings → Website**. The **Snippet** card on the **Dashboard** shows tracking as active once your first visit is tracked.
4. Add `?ply_debug=1` to any URL to see detailed logs in the console.

## Behavior details and limitations

- **Install once per page.** If the snippet loads twice, only the first copy runs ("another instance is already initialized" in the console).
- **One snippet per website.** Each website in Personizely has its own key. A site on several domains can use one website if the domains share a root domain (subdomains share the visitor cookie); separate domains are best set up as [Multiple websites](docId\:xTmxPcoGPGtWkYgcZd69E).
- **Content Security Policy.** If your site sends a CSP header, allow Personizely's hosts. See [Content Security Policy (CSP)](docId\:kHb2SYuGO9A2ulTVoNa_J).
- **Consent tools.** If your consent manager blocks scripts until the visitor opts in, Personizely runs only after consent, and visitors who don't consent see your original site. See [Cookies and consent](docId:-HA6dgPmpYmb7x6UZQ_t2).
- **Platform features need the platform integration.** Cart targeting, cart triggers and server-side order tracking need the [Install Personizely on Shopify](docId\:KKBkXcEXtFXCVJdjXvQ74) or [Install Personizely on Wix](docId\:vDhDOgYkOjfqPi3DwNtcY) integration, and theme, template, price and shipping tests need Shopify. A script tag alone doesn't enable them.

## Related

- [Install Personizely](docId\:fLX7cCmHhCf5QIV_3gGvF)
- [Verify and troubleshoot your installation](docId\:fM8b-wlEZqwZo2lSY7r4i)
- [Performance and flicker](docId\:sgD1BsYNMvpjqHqp_qcdi)
- [Google Analytics 4 and GTM](docId\:NwHWpmwoIntBLz7-PTe3q)
- [JavaScript API (window.ply)](docId\:d64TegyOiwNA2GFG1eXPm)
- [Content Security Policy (CSP)](docId\:kHb2SYuGO9A2ulTVoNa_J)
