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:

RequirementWhy it mattersHow to check
Site is publishedCustom 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 upgradedWix 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 connectedWix 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 snippetYou 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.

Throughout this guide we use a placeholder: <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 toolWhere to add it on Wix
Google Analytics, Google Tag Manager, Facebook pixel or TikTok pixelWix marketing integrations (not custom code, per Wix)
Another tool that gives you a script for the head of every pageSettings > 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

  1. Sign in to Wix and open your site's dashboard (not the editor).
  2. Click Settings.
  3. 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.
  4. 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

  1. Paste the code into the text box, exactly as your tool gives it, including the opening and closing <script> tags.
  2. 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:

OptionWhat Wix says it doesUse it for a tracking tag?
All pagesApplies 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 pagesLoads 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.

PlacementWhere the code ends upTypical use
HeadInside the page's <head>Analytics, heatmap and pop-up tags; site verification
Body - startAt the top of the <body>Scripts a vendor asks to run as the page starts drawing
Body - endAt 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 typeWhat Wix says it is for
EssentialCore site operations such as security, identity verification and network management
MarketingMeasuring ad effectiveness and delivering more relevant ads
AnalyticShowing how visitors use the site and helping find errors
FunctionalRemembering 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.

marketingLABO doesn't include a cookie consent tool. Decide your consent setup with your own privacy advisor, then set the Wix code type to match. This guide describes Wix's settings, not legal advice.

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:

  1. 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.
  2. Accept the cookie banner if you have one and you set a non-essential code type. Otherwise the code may be waiting for consent.
  3. 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.
  4. 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.
  5. 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

SymptomLikely causeWhat to do
No Custom Code option, or it asks you to upgrade or connect a domainThe site isn't upgraded, or no domain is connected yetUpgrade the site and connect your domain, then publish.
Snippet isn't in the page source at allToggle is off, wrong pages selected, or you're viewing a different site or a free Wix URLCheck 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 recordedCode is set to load once per visitEdit the snippet and choose to load it on each page your visitor opens.
Data appears for you but not for some visitorsCode type is non-essential and those visitors declined or haven't answered the cookie bannerExpected 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 nothingScript blocked by Wix's frontend security, a browser extension, or a typo from retypingOpen 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 changeWix deletes snippets when you assign a different domainAdd 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:

  1. Network functions are locked. Wix replaces the browser's fetch and XMLHttpRequest with secured versions that can't be replaced or reassigned, so scripts that wrap them to intercept traffic don't work.
  2. Wix's own cookies are off-limits. Reading or writing Wix internal or security cookies fails silently.
  3. Core objects are locked. Objects such as URL, JSON, String and Object, plus addEventListener, can't be overwritten or extended.
  4. Timers need functions. setTimeout and setInterval don'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:

  1. Pause it with the toggle. Useful for troubleshooting, or when you stop using a tool but might come back.
  2. Edit it to change the pages, the load setting, the placement or the code type, or to paste an updated snippet from your provider.
  3. 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:

  1. 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.
  2. Visitor history. A per-visitor timeline of the pages they viewed.
  3. Micro-conversions. Count goals by number of pages viewed, a specific URL, time on page or return visits.
  4. 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

MistakeWhat happensFix
Adding code before connecting a domainWix's prerequisite isn't met.Upgrade, connect the domain, publish, then add the code.
Using Custom Code for Google Analytics or a Facebook pixelWix says these don't work through custom code.Use Wix marketing integrations for those tools.
Choosing specific pages for a site-wide tagNew and unchosen pages aren't tracked.Use All pages.
Loading once per visitOnly the first page of a visit may be recorded.Load on each page your visitor opens.
Leaving every tag as EssentialNon-essential code runs before consent.Pick the code type that matches the tool.
Pasting a second copy of the same tagDouble page views.Keep one active snippet per tool.
Forgetting snippets after a domain changeTracking stops silently.Re-add snippets the same day.

Quick checklist

  1. Site upgraded, domain connected, site published.
  2. Tool isn't one Wix routes through marketing integrations.
  3. Snippet copied directly from your tool and pasted once in Settings > Custom Code.
  4. Named clearly, set to All pages, loading on each page your visitor opens.
  5. Placed in Head.
  6. Code type set to match what the tool does.
  7. Verified in a private window on several pages, plus your tool's own tracking check.
  8. 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.

  1. Wix Help Center: Embedding Custom Code on Your Site
  2. Wix Help Center: Categorizing Your Custom Code
  3. Wix Help Center: Connecting a Domain to Wix Using the Pointing Method
  4. Wix Developers: About Frontend Security

Start free — no credit card needed

Sign up free

More articles