How to Add Custom Code to the Head of a Wix Site (Settings > Custom Code)
Analytics, heatmap and pop-up tools usually ask for one thing: put a short script in the <head>of every page. On Wix you don't edit a template file to do that. You use the Custom Codescreen in your site's dashboard settings. This guide walks through it step by step, explains the requirements Wix documents today (a published site with a connected domain), and covers the settings that quietly decide whether your tag works: which pages, how often it loads, and which code type it gets.
Updated

Before you start: what Wix requires
Wix's help article on embedding custom code has one prerequisite, and it is easy to miss: "Make sure that your site is published and has a connected domain." If you are still building, or your site lives on a free Wix address, the Custom Code option won't do what you need yet.
A connected domain, in turn, depends on your plan. Wix's article on connecting a domain states: "You must upgrade your Wix site before you can connect your domain." Put together, the practical checklist looks like this:
| Requirement | Why it matters | How to check |
|---|---|---|
| Site is published | Custom code is added to the live site that visitors see. | Your editor shows a published state, and the site opens at its public address. |
| Site is upgraded | Wix says you must upgrade before you can connect a domain. | Look at the plan shown for this site in your Wix account. A plan bought for a different site doesn't count. |
| Domain is connected | Wix lists a connected domain as a prerequisite for custom code. | The site opens at your own domain (for example, www.yourbrand.com), not a free Wix URL. |
| You have the snippet | You paste it exactly as your tool provides it. | Copy it straight from your tool's dashboard. Don't retype it. |
Plan names and prices change, so we don't list them here. Check the upgrade options in your own Wix account; what matters for this guide is that the site is upgraded and your domain is connected to it.
Have the script ready before you open the dashboard. In marketingLABO, for example, you register your site with its name and URL, and the dashboard then shows your tracking tag with a Copy tag button and the instruction to paste it right before </head> on every page. On Wix, "right before </head>" translates to the Head placement, which we set in Step 4.
<script src="https://...your tag..."></script>. Always paste the exact snippet from your own tool's dashboard, not this example.Custom code or a marketing integration?
Wix offers two routes for third-party scripts, and its help article is explicit about which tools belong where: "Tracking scripts such as Google Analytics, Google Tag Manager, and Facebook & TikTok pixels do not work through custom code." For those, Wix points you to its marketing integrations, which have their own setup screens.
For tools that don't have a Wix integration, such as many heatmap, pop-up and visitor analytics tools, the Custom Code screen is the documented way to add a snippet. A quick way to decide:
| Your tool | Where to add it on Wix |
|---|---|
| Google Analytics, Google Tag Manager, Facebook pixel or TikTok pixel | Wix marketing integrations (not custom code, per Wix) |
| Another tool that gives you a script for the head of every page | Settings > Custom Code, placed in Head, on all pages |
| A widget that should be visible on the page (a video, a calendar) | Not custom code. Wix suggests an embed (iFrame with HTML) for visible content. |
If you aren't sure, read your vendor's instructions. Many tools publish a Wix-specific page that tells you which route they support.
Step 1: Open Settings > Custom Code
- Sign in to Wix and open your site's dashboard (not the editor).
- Click Settings.
- Find Custom Code. Wix's current article places it in the Development & integrations section. Older screenshots online show it under an "Advanced" heading, so if your screen looks different, scroll the Settings page and look for the Custom Code name.
- Click + Add Custom Code at the top right.
A panel opens with a text box for your snippet and a few settings below it. Don't click Apply until you have gone through Steps 2 to 5; the defaults aren't always what a tracking tag needs.
Step 2: Paste the snippet and name it
- Paste the code into the text box, exactly as your tool gives it, including the opening and closing
<script>tags. - Give it a recognizable name, such as "marketingLABO tag" or "Heatmap tool (added Oct 2026)". You will see this name in your list of snippets later, and a clear name makes troubleshooting and removal much easier.
Paste the snippet once. If the same tool is also installed some other way, such as an app or a previous snippet you forgot about, page views can be counted twice. Check the Custom Code list for older entries before you add a new one.
Step 3: Choose All pages, and load it on each page
Under Add Code to Pages, Wix offers two choices:
| Option | What Wix says it does | Use it for a tracking tag? |
|---|---|---|
| All pages | Applies the code to every page, including pages you add later. You also choose whether to load it once per visit or on each page your visitor opens. | Yes. Tools that ask for the tag "on every page" need this. |
| Choose specific pages | Loads the code only on the pages you pick from a drop-down. | Only if your vendor tells you to limit it. |
When you pick All pages, Wix asks you to "choose whether to load the code only once per visit, or on each page your visitor opens." This setting matters more than it looks. Many tools record a page view when their script loads. If the script loads only once per visit, the tool may see the first page a visitor lands on and miss the rest of their path.
For marketingLABO, choose the option that loads the code on each page your visitor opens. The tag works from page loads, and reports such as visitor history, heatmaps and page-based targeting for banners depend on seeing every page a visitor views. If another tool tells you to load once, follow its instructions for that tool.
Step 4: Place the code in Head
Under Place Code in, Wix offers three positions: Head, Body - start and Body - end. Its FAQ gives the general rule: tracking and verification codes usually go in the head, functional scripts in the body, but the provider's instructions take priority.
| Placement | Where the code ends up | Typical use |
|---|---|---|
| Head | Inside the page's <head> | Analytics, heatmap and pop-up tags; site verification |
| Body - start | At the top of the <body> | Scripts a vendor asks to run as the page starts drawing |
| Body - end | At the bottom of the <body> | Scripts that should wait until the page content is there |
marketingLABO asks for its tag right before </head> on every page, so choose Head. You can't pick the exact line inside the head on Wix; the Head placement is the equivalent.
Step 5: Set the code type
The panel also has a Code Type tab. It is easy to skip, but it decides when your code is allowed to run. Wix's article on categorizing custom code lists four categories:
| Code type | What Wix says it is for |
|---|---|
| Essential | Core site operations such as security, identity verification and network management |
| Marketing | Measuring ad effectiveness and delivering more relevant ads |
| Analytic | Showing how visitors use the site and helping find errors |
| Functional | Remembering visitor choices for a more personalized experience |
The detail to know: "Custom codes are categorized as essential by default." Wix explains that essential code "is loaded prior to visitor consent and cannot be disabled," and that if your code fits another category, changing it is your responsibility. Wix also reminds site owners that privacy laws such as the GDPR "require that your visitors can decline the use of non-essential cookies while using your site."
An analytics or heatmap tag is not an essential site operation, so leaving it on the default is usually the wrong choice if you serve visitors in places with consent rules. Pick the category that honestly describes what the tool does, and remember the trade-off: code that waits for consent won't run, and won't collect data, for visitors who decline or never answer the banner. That is expected behavior, not a broken install.
Step 6: Apply, then check that it works
Click Apply. The snippet now appears in your Custom Code list with an on/off toggle. Then confirm it actually loads on the live site:
- Open your site in a private window, at your connected domain. A private window shows the site the way a new visitor sees it and avoids confusion with your logged-in Wix session.
- Accept the cookie banner if you have one and you set a non-essential code type. Otherwise the code may be waiting for consent.
- View the page source (Ctrl+U on Windows, Option+Cmd+U in Chrome on Mac) and search for a recognizable part of your snippet, such as its domain. Wix pages contain a lot of generated code; the search is quicker than scrolling.
- Click through three or four pages, not just the home page. This is where the "load on each page" setting shows up in your data.
- Use your tool's own check. In marketingLABO, open any page of your site, then press Check tracking in the dashboard. If nothing has arrived, the dashboard suggests confirming the tag is on every page and your changes are saved and published, then reloading your site and trying again.
After a few minutes of browsing, look for your own visit in the tool. In marketingLABO, the visitor history timeline should list each page you opened, in order. If it shows only the first page, revisit Step 3 and make sure the code loads on each page your visitor opens.
If the tag doesn't load: a troubleshooting table
| Symptom | Likely cause | What to do |
|---|---|---|
| No Custom Code option, or it asks you to upgrade or connect a domain | The site isn't upgraded, or no domain is connected yet | Upgrade the site and connect your domain, then publish. |
| Snippet isn't in the page source at all | Toggle is off, wrong pages selected, or you're viewing a different site or a free Wix URL | Check the toggle and All pages in the snippet's settings; open the site at your connected domain. |
| Only the first page of each visit is recorded | Code is set to load once per visit | Edit the snippet and choose to load it on each page your visitor opens. |
| Data appears for you but not for some visitors | Code type is non-essential and those visitors declined or haven't answered the cookie banner | Expected with consent. Review the code type only if it doesn't match what the tool does. |
| Snippet is present but the tool reports errors or nothing | Script blocked by Wix's frontend security, a browser extension, or a typo from retyping | Open the browser console for errors, try a browser without blockers, re-copy the snippet, and contact the tool's provider. |
| Tracking stopped after a domain change | Wix deletes snippets when you assign a different domain | Add the snippet again (see below). |
Wix suggests a simple method for finding a snippet that breaks something: turn off each snippet's toggle one at a time and test the site after each change. Because every snippet has its own toggle, you can do this without deleting anything.
Wix frontend security and older snippets
Wix's custom code article notes that "In December 2025, Wix introduced new frontend security measures for custom code on Wix sites," and that older snippets may be blocked until their providers update them. Wix's developer documentation describes what these measures do. Among other things:
- Network functions are locked. Wix replaces the browser's
fetchandXMLHttpRequestwith secured versions that can't be replaced or reassigned, so scripts that wrap them to intercept traffic don't work. - Wix's own cookies are off-limits. Reading or writing Wix internal or security cookies fails silently.
- Core objects are locked. Objects such as
URL,JSON,StringandObject, plusaddEventListener, can't be overwritten or extended. - Timers need functions.
setTimeoutandsetIntervaldon't accept a string as their first argument.
You don't need to understand the code to use this. If your snippet is in the page source but the tool shows nothing, open your browser's developer console (F12 on most browsers) and look for errors. Wix says blocked operations either fail silently or throw an error with a specific code. Share what you see, and Wix's frontend security page, with your tool's provider. Wix states that it doesn't support technical issues with third-party snippets, so the provider is the right contact.
Editing, pausing and removing the code
Everything you add lives in the Custom Code list under Settings. From there you can:
- Pause it with the toggle. Useful for troubleshooting, or when you stop using a tool but might come back.
- Edit it to change the pages, the load setting, the placement or the code type, or to paste an updated snippet from your provider.
- Remove it when you stop using the tool for good. Unused scripts still load for every visitor, so clean them up.
Keep a short list somewhere outside Wix (a shared doc or password manager note) of every snippet you have added, the tool it belongs to and why it is there. When someone on your team asks "what is this script?" a year from now, that list answers it.
Changing domains deletes your snippets
This one catches people during rebrands. Wix's article states: "If you assign a different domain to your site, your code snippets will be deleted." If you move your site to a new domain, plan to add every snippet again right afterwards, and check your tools the same day so you don't lose data.
Wix also notes that secondary domains don't need their own snippets, because traffic redirects to the primary domain.
If you register a new domain in your tool as well, update it there too. In marketingLABO, the site URL you registered should match the domain visitors actually use.
What a head tag can do on Wix, and what it can't
Once the snippet loads on every page, a page-level tool sees what happens on those pages. With marketingLABO on a Wix site, that means:
- Analytics and heatmaps. Reports by traffic source, page and conversion, plus per-page heatmaps of time on page, scroll depth and clicks. See our guide to website heatmaps for how to read them.
- Visitor history. A per-visitor timeline of the pages they viewed.
- Micro-conversions. Count goals by number of pages viewed, a specific URL, time on page or return visits.
- Pop-up banners. Show a banner immediately, after a delay, at a scroll depth or on exit intent, targeted by page URL, visit count, days since last visit, pages viewed or not viewed, and traffic source.
And what it doesn't do: marketingLABO isn't a Wix app and doesn't connect to Wix Stores, Bookings or your Wix contact list, so it doesn't read cart contents, orders or payments. For sales figures, keep using Wix's own reports. A specific-URL micro-conversion on a page that only appears after a key step is a reasonable page-level signal, but it isn't an order count.
If you sell online, our guide to cart abandonment covers what you can learn from page behavior before checkout, and form abandonment covers contact and sign-up forms.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Adding code before connecting a domain | Wix's prerequisite isn't met. | Upgrade, connect the domain, publish, then add the code. |
| Using Custom Code for Google Analytics or a Facebook pixel | Wix says these don't work through custom code. | Use Wix marketing integrations for those tools. |
| Choosing specific pages for a site-wide tag | New and unchosen pages aren't tracked. | Use All pages. |
| Loading once per visit | Only the first page of a visit may be recorded. | Load on each page your visitor opens. |
| Leaving every tag as Essential | Non-essential code runs before consent. | Pick the code type that matches the tool. |
| Pasting a second copy of the same tag | Double page views. | Keep one active snippet per tool. |
| Forgetting snippets after a domain change | Tracking stops silently. | Re-add snippets the same day. |
Quick checklist
- Site upgraded, domain connected, site published.
- Tool isn't one Wix routes through marketing integrations.
- Snippet copied directly from your tool and pasted once in Settings > Custom Code.
- Named clearly, set to All pages, loading on each page your visitor opens.
- Placed in Head.
- Code type set to match what the tool does.
- Verified in a private window on several pages, plus your tool's own tracking check.
- Snippet listed in your team's notes, and re-checked after any domain change.
FAQ
Can I add custom code on a free Wix site? Wix lists a published site with a connected domain as the prerequisite, and says you must upgrade your site before you can connect a domain. So in practice, plan on an upgraded site.
Do I paste the code in the Wix Editor? No. Custom Code is in your site's dashboard under Settings, not inside the editor. Wix suggests an embed for code that should be visible on the page.
Head or Body - end? Follow your tool's instructions. Wix's general rule is head for tracking and verification codes, body for functional scripts. marketingLABO asks for the head.
Will Wix support help if the script doesn't work? Wix says it doesn't provide support for technical issues with third-party snippets and asks you to contact the provider. Wix can help with its own settings, such as domains and plans.
I also run a Squarespace, Shopify or WooCommerce site. Is it similar? The goal is the same (the tag in the head of every page), but the steps differ. See Squarespace code injection, adding a tracking script to Shopify and adding a script to the head of a WooCommerce store.
marketingLABO's Free plan includes one site with analytics, heatmaps and visitor history, plus one form and one pop-up banner, with no time limit and no credit card required. Compare plans in the pricing section, or sign up free to get your tag.
Sources
All checked on October 12, 2026.
Start free — no credit card needed
Sign up freeMore articles

Squarespace Code Injection: Adding a Tracking Tag to Every Page
Use Squarespace code injection to add a tracking tag to the head of every page: which plans include it, where to find it in 7.1 and 7.0, and how to test it.
Read the article →
What Is Marketing Automation? A Plain-English Guide for Small Online Stores
Marketing automation in plain English: tracking, segments and triggered messages, with small-store examples, starter automations and the email rules to follow.
Read the article →
How to Add a Tracking Script to Your Shopify Store (theme.liquid, Step by Step)
Add a tracking script to your Shopify theme.liquid safely: back up, paste before </head>, test, roll back, and know what checkout and thank-you pages allow.
Read the article →
How to Add a Script to the <head> of a WooCommerce Store (Without Breaking Your Theme)
Add a tracking script to the head of a WooCommerce store with the wp_head hook: a tiny plugin or a child theme, for classic and block themes, plus testing.
Read the article →
Website Heatmaps Explained: Click, Scroll and Mouse-Movement Maps for Small Sites
What click, scroll and mouse-movement heatmaps show, how to read scroll depth on product pages, and the common misreads that lead small sites to the wrong fix.
Read the article →
Cart Abandonment: Why Shoppers Leave and What You Can Do On-Site
Why shoppers abandon carts, based on Baymard Institute research, and the on-site fixes and returning-visitor reminders that address each reason.
Read the article →