How to add custom code to a Wix site
Wix accepts third-party scripts through a Custom Code page in the site dashboard. It is stricter than most builders: the site needs a connected domain before code is allowed, and Wix warns that some snippets get blocked. Read the pitfalls before you promise anyone a launch date.
Before you start
- A published site with a connected domain. Connecting a custom domain needs a paid Wix plan.
- A Wix Editor, Wix Studio, Studio Two or Wix Harmony site
- The script from your tool, as a complete <script> tag
Steps
- Open Custom Code in the dashboardGo to Settings in the site dashboard. Under Development & integrations, click Custom Code.
- Add the snippetClick + Add Custom Code, paste the tag and give it a name.
<script defer src="https://example.com/tool.js"></script>An example tag. Paste the one your tool gave you. - Set the pages and the placementUnder Add Code to Pages choose All pages. For Place Code in, choose Head. Wix also asks whether the code loads once per visit or on each page a visitor opens; take that from your tool’s instructions.
- Apply, then test on the published siteClick Apply. Custom code doesn’t take effect in the editor and runs only on the published site, so open the live domain to test.
Check it worked
- On the live domain, open developer tools, reload, and look for the script’s request in the Network tab.
- Watch the Console tab on the same page for a blocked-script error naming your snippet.
What goes wrong
- Wix blocks the snippet
- Wix added frontend security measures in December 2025 and says some snippets may be blocked until their provider updates them. If yours is, send the console error to the vendor; you cannot fix it from the dashboard.
- An analytics tag or pixel does nothing
- Wix’s documentation says tracking scripts such as analytics tags and pixels do not work through custom code. Ask the tag’s vendor how they support Wix before spending time here.
- A script that edits the page stops working
- Wix has no stable selectors, and its renderer may re-render the DOM and undo a change. Test on your own pages any script that finds elements and rewrites them, and retest after you edit the site.
- The snippets disappeared
- Changing the site’s primary domain deletes custom code snippets. Keep a copy of each tag and add them again after a domain change.
Checked on 2026-11-11 against Wix Developers: About custom code, Wix Help Center: Embedding custom code on your site.
Increase conversions on your Wix site by 20%
Dynamite personalizes the page for every visitor. Dynamite is website personalization that installs as a single script tag in a site’s head, added the way this guide describes. The linked page walks through that install on Webflow.
Dynamite for WebflowQuestions
Can I add custom code to a free Wix site?
Wix requires the site to be published and to have a connected domain, and connecting a custom domain needs a paid plan.
Why is my code not running in the Wix editor?
Wix states that custom code doesn’t take effect in the editor. It runs on the published site only.
How do I turn a snippet off?
Each snippet on the Custom Code page has a toggle that disables it.