Webflow sync, pageviews & more.
NEW

How can I make this code work on my Webflow page? I've tried adding it to the footer in project settings, the specific page's footer, and an embedded code element, but it's not showing on the published site.

TL;DR
  • Use the Embed element for visible content and Custom Code sections (page or site-wide) for scripts.
  • Always publish the site to view custom code live and use browser developer tools to debug errors or loading issues.

You're trying to add custom code to display or function on your Webflow site, but it's not appearing after trying common methods. Here's how to correctly troubleshoot and implement custom code in Webflow.

1. Confirm Script Type (Third-party or Custom Script)

  • If you're using JavaScript code, confirm whether it's inline (<script>...) or an external source (<script src="...">).
  • Make sure the script itself is valid and doesn't throw errors (test in browser console).
  • If it's a widget or embedded element (like a booking widget or chatbot), double-check the platform-specific instructions for Webflow integration.

2. Add Code to the Right Placement

  • Use Embed element (from the Add panel) for code that generates visible content, such as widgets or iframes.
  • Paste the code directly into the Embed component if it includes HTML and inline JS (e.g., forms, buttons).
  • For site-wide scripts (e.g., analytics), go to Project Settings > Custom Code > Footer or Head depending on when the script should load.
  • For page-specific scripts, open the desired page, scroll to Page Settings > Custom Code > Footer.

3. Publish the Site (Not Just Preview)

  • Custom code doesn't render in Webflow's preview mode or Designer.
  • After adding the script, click Publish and view the live version of the site to test.
  • If you’re using a staging domain (like yourproject.webflow.io), ensure you publish to that domain.

4. Check Script Visibility Rules

  • Some scripts require a page to be fully loaded. If you're rendering content into elements via JavaScript, ensure the element exists at runtime.
  • Wrap custom code in a DOMContentLoaded or window.onload to delay execution if needed.
  • Hidden or display:none containers may prevent scripts from injecting visible UI.

5. Inspect the Console and Network Tab

  • In your browser (usually Chrome), go to the Developer Tools (F12) and check the Console tab for errors.
  • In Network tab, verify if the script source is being downloaded successfully.
  • Fix any import or CORS issues.

6. Verify External Hosting and Permissions

  • If linking to an external script, confirm that the URL is correct and that hosting allows embedding.
  • Some content has embedding restrictions via headers like X-Frame-Options or may block cross-origin requests.

Summary

To ensure your custom code works in Webflow:

  • Use the Embed element for visual content and Custom Code areas for functional scripts.
  • Always publish to see the script live.
  • Use browser dev tools to troubleshoot script errors or loading issues.

If you can share the code snippet (or a description of what it's supposed to do), I can provide more specific steps.

Rate this answer

Other Webflow Questions