How to add custom code embeds on Webflow
Add custom code embeds in Webflow by using the Embed element for inline code or accessing Project Settings for site-wide code. You can embed HTML, CSS, and JavaScript directly into your pages or across your entire site.
Prerequisites
- Active Webflow account with a project
- Basic understanding of HTML/CSS/JavaScript
- Published Webflow site
- Custom code ready to embed
Step-by-Step Instructions
Access the Webflow Designer
Add an Embed Element for Page-Specific Code
Insert Your Custom Code
<style> tags and JavaScript in <script> tags.Configure Site-Wide Custom Code
Add Page-Specific Head Code
Test Your Custom Code
Publish Your Changes
Common Issues & Troubleshooting
Custom code not appearing on published site
Ensure you've clicked Publish after adding the code. Check if code is wrapped in proper <script> or <style> tags, and verify there are no syntax errors in your code.
JavaScript errors in browser console
Validate your JavaScript syntax and ensure all required libraries are loaded. Move JavaScript code to the Footer tag in Project Settings if it depends on page elements being loaded first.
Embed element showing code instead of executing
Make sure your code includes proper HTML tags. For JavaScript, wrap code in <script> tags. For CSS, use <style> tags. Check that you're not mixing plain text with code.
Custom code affecting site performance
Move heavy JavaScript to load asynchronously by adding async or defer attributes to script tags. Consider loading third-party scripts conditionally or only on specific pages where needed.