Webflow sync, pageviews & more.
NEW

How can I fix the W3C validation errors related to the noscript tag and the Facebook pixel code in the head tag of my Webflow website?

TL;DR
  • Place only the Facebook Pixel JavaScript in Webflow’s Head Code section.
  • Move the

W3C validation errors often appear in Webflow sites when you insert Facebook Pixel code, especially within <noscript> tags inside the head. W3C expects <noscript> to be used only within the body, not the head.

1. Understand the Problem

  • Facebook's Pixel code includes a <noscript> tag meant for browsers without JavaScript.
  • Placing <noscript> in the head section violates standard W3C HTML5 rules.
  • Webflow provides a Head Code field under Project Settings, but anything placed there renders inside the <head>, causing validation issues.

2. Move the <noscript> Tag to the Body

  • Don't place the full Facebook Pixel code in the Head Code section.
  • Instead, split the script:
  • Place only the JavaScript (script block) in the Head Code.
  • Place the noscript image pixel inside the Before Tag section.

3. How to Do It in Webflow

  • Go to Project Settings > Custom Code.

  • In the Head Code section, paste only the JavaScript like:

    <!-- Facebook Pixel JavaScript -->

  • In the Before Tag section, paste just the noscript block:

    <!-- Facebook Pixel noscript block -->

  • Typically, the noscript image pixel looks like this:

    <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/></noscript>

  • This moves the non-compliant tag from head to body, resolving validation errors.

4. Publish and Re-Validate

  • Click Publish to update the live site.
  • Re-run the W3C validator to confirm the <noscript> tag is no longer flagged.

Summary

To fix W3C validation errors from Facebook Pixel code, split the code: place the script portion in the Head Code, and the <noscript> image tag in the Before section. This keeps your site standards-compliant while preserving Pixel functionality.

Rate this answer

Other Webflow Questions