Figment.so
BlogHow to usePricing

Adding Custom Code to a Wix Site

Wix's Custom Code feature, under Settings → Custom Code, injects a raw HTML, CSS or JavaScript snippet into a page's <head> or <body>, on all pages or specific ones you choose — and Wix requires the site to be published and have a connected domain before the option works at all. It runs in every Wix editor, including Harmony, but it can't touch Wix's own APIs, page elements, or data collections — for that, you need Velo instead. Here's exactly what Custom Code does, sourced from Wix's developer documentation and help center, checked September 2026.

Where do I find Custom Code, and what does it need first?

Wix's developer documentation states the location plainly: "You add custom code from the site dashboard under Settings > Custom Code" (Wix Developers, "About Custom Code", checked September 2026). Before you can use it, Wix's own note is direct about the requirement: "To add custom code, the site must be published and have a connected domain." A site still on its default free wixsite.com address, or one that's never been published, won't have this option available.

Wix's Editor-level walkthrough gives the exact click path and settings (Wix, "Wix Editor: Embedding Custom Code on Your Site", checked September 2026):

  1. Go to Settings in your site's dashboard.
  2. Click Custom Code in the Development & integrations section.
  3. Click + Add Custom Code at the top right.
  4. Paste your code snippet into the text box.
  5. Enter a name for the snippet, so you can identify it later.
  6. Choose where it applies, under Add Code to Pages: All pages (including any pages you create later, with the option to load the code once per visit or on every page load), or Choose specific pages from a dropdown.
  7. Choose placement, under Place Code in: Head, Body – start, or Body – end.
  8. Click Apply.

Wix's guidance on placement is straightforward: "the placement of your code is crucial for it to load and execute properly," and whichever third party supplied the snippet should tell you which of the three it needs.

Does Custom Code work the same way on Wix Studio and Wix Harmony?

Yes for where it's configured — Wix's developer docs state plainly: "Custom code can be used in all Wix editors." On Harmony specifically, which has no site-code layer at all, custom code carries more weight: "For Wix Harmony sites, which don't support site code, custom code is one of the primary ways to extend a site's functionality beyond what the editor provides." Wix's own "About Wix Harmony" page confirms the same boundary: "Wix Harmony doesn't support site code. If your projects require code customization, continue using Wix Editor or Wix Studio. However, you can use custom code to add HTML, JavaScript, and CSS snippets to Harmony sites" (Wix Developers, "About Wix Harmony", checked September 2026). Harmony also has its own separate Embed element for visible content, covered below.

What can Custom Code actually be used for?

Wix's documentation groups the realistic use cases into a few buckets:

  • Third-party site verification, such as the <meta> tag search engines like Google and Bing require to confirm you own the site.
  • Live chat widgets, where a support platform provides a script tag to display its chat interface.
  • Cookie consent banners, for GDPR/CCPA-style compliance tools that need their own snippet.
  • Custom CSS beyond what the editor's own style panel offers — loading a Google Fonts font via a <link> tag, overriding spacing or typography on standard HTML tags, or styling browser UI elements like scrollbars.
  • Custom JavaScript, for things like pulling live data from an external API, or adding a self-contained interactive widget (a countdown timer, a calculator) that doesn't depend on Wix's own page elements.
  • Structured data for SEO, adding JSON-LD scripts for schema types like LocalBusiness, FAQPage, or Event so search engines can render richer results.

What can't Custom Code reach or do?

Several real limits, stated directly by Wix:

  • No access to Wix's own APIs. "Custom code can't interact with Wix page elements ($w selectors), data collections, backend methods, or business solutions like Stores, Bookings, or Pricing Plans. It can only work with the raw HTML DOM and external resources."
  • Tracking pixels don't work through it. "Tracking scripts for Google Analytics, Google Tag Manager, and Facebook & TikTok pixels don't work through custom code. Connect these to a site using marketing integrations instead." If your goal is GA4 or a Meta/TikTok pixel, Marketing Integrations — not Custom Code — is the documented path.
  • No stable selectors. "Wix generates class names and element IDs dynamically. CSS rules or JavaScript that target these identifiers may break when a site is re-published or updated."
  • No guaranteed DOM compatibility with Wix's own rendering engine, especially around page transitions or viewport changes.
  • No editor visibility. Snippets "don't appear as elements in the editor," so a collaborator working visually may not know one exists.
  • No backend execution. "All custom code runs in the browser." For server-side logic — a secure API call, data processing, a scheduled job — Wix points you to the Wix JavaScript SDK on Editor or Studio instead, which is Velo's territory.

Wix also flags a security caution directly: custom code "is injected directly into the page's HTML and is visible to anyone who views the page source or uses browser developer tools. Don't include API keys, passwords, or other sensitive data in custom code snippets." A secret key belongs in backend code or a proxy, never in a head/body snippet.

What's the difference between Custom Code and the Embed HTML element?

They solve different problems. Custom Code is a site-wide dashboard setting that injects invisible script or style tags — Wix's Editor article confirms these "snippets are always invisible to your site visitors." The Embed element is a visible, on-canvas block instead: in Harmony, you add it from Add Elements → More Options → Embed, then choose either Embed code (paste HTML for a widget) or Embed a site (show an external HTTPS page inside your page) (Wix, "Wix Harmony Editor: Embedding a Link or HTML Code", checked September 2026). Wix's Custom Code FAQ draws the same line: "How do I embed visible code on my site? Add an iFrame with HTML code to display visual content on your site." In short — Custom Code for invisible head/body scripts that affect the whole page, Embed for one visible widget placed like any other canvas element.

Where does Velo take over?

Right where Custom Code's limits stop, by Wix's own framing: Custom Code and Velo (Wix's site-code layer) "serve different purposes." Wix's developer documentation lays out the split directly:

Custom codeSite code (Velo)
PurposeInject standalone code snippetsBuild integrated site functionality
Access to Wix APIsNoneFull access to Wix APIs, elements, and data
Wix Harmony supportYesNo
Runs onBrowser onlyBrowser and backend

If what you need is to read or write your site's own data collections, respond to a Wix event (like a completed booking or a new form submission) with custom logic, or call an outside API from a place where a secret key stays hidden, that's Velo, not Custom Code — and Velo isn't available on Harmony at all. Our guide to what Velo actually is and what code runs where covers frontend page code, backend web modules, and the database access Velo gives you, without repeating the Custom Code details above. If you're not sure which editor your site is on to begin with, our Wix Harmony vs. Wix Editor vs. Wix Studio guide covers how to check.

What happens if I change my domain, and how do I verify a snippet is working?

Wix's FAQ flags a real recovery-path detail before you switch domains: "Your code snippets are associated with a specific domain. If you assign a different domain to your site, your code snippets will be deleted." Back up any working snippet's text outside Wix first, since there's no restore step afterward — you'd be pasting it back in from scratch.

Custom code also "doesn't take effect in the editor and only runs on the published site," so previewing in the editor won't show it. Check with your browser's developer tools instead — page source, applied styles, or console output on the live site — and for structured data specifically, Google's own Rich Results Test to confirm JSON-LD is detected and valid.

Where does Figment fit in?

Not directly — Figment publishes a static site from a Figma design through its Figma plugin, and it has no Settings-level Custom Code panel, Embed element, or Velo layer to compare against what's described here. If a Wix site's reason for needing custom code is a specific tracking pixel, use Marketing Integrations as Wix documents above rather than Custom Code; if it's data, bookings, or backend logic, that's Velo's job, and it's worth checking our free-plan guide too, since a free wixsite.com site can't use Custom Code at all until it's upgraded and has a connected domain.

Bottom line: Wix's Custom Code lives at Settings → Custom Code, injects HTML/CSS/JS into a page's head or body on a published site with a connected domain, and works the same way across the Editor, Studio, and Harmony — but it can't touch Wix's APIs, data, or tracking-pixel integrations, and it runs only in the browser. Use the Embed element instead for a visible on-page widget, Marketing Integrations for GA4 or ad pixels, and Velo once you need real access to your site's data or backend logic.


Get the latest content from Figment. Subscribe today for Figma design guides and website building tips.


Figment.so

Contact

Twitter

Pricing

Privacy

Terms