Install with a script tag or Google Tag Manager
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
- In Personizely, go to Settings → Website.
- Copy the code from the Code block. It looks like this, with your own website key:
<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
- 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.
- Put it in your site's shared layout or header template, so every page gets it, including landing pages and the order confirmation page.
- 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.
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.
Install with Google Tag Manager
- In GTM, create a Custom HTML tag and paste the snippet.
- Set the trigger to Initialization - All Pages (or All Pages).
- Preview, then publish the container.
Check code in Personizely detects snippets added through a tag manager.
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. 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 based on page views (such as /order-confirmation), clicks, form submits, scroll or time.
- The JavaScript API (window.ply): 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
- Open your site in a normal browser window and open the developer console. You should see Personizely initialized. Startup time: <n>ms.
- View the page source (or, for GTM, the Elements panel) and check that the script appears once.
- In Personizely, click Check code in Settings → Website. The Snippet card on the Dashboard shows tracking as active once your first visit is tracked.
- 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.
- Content Security Policy. If your site sends a CSP header, allow Personizely's hosts. See Content Security Policy (CSP).
- 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.
- Platform features need the platform integration. Cart targeting, cart triggers and server-side order tracking need the Install Personizely on Shopify or Install Personizely on Wix integration, and theme, template, price and shipping tests need Shopify. A script tag alone doesn't enable them.