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
  • Move the <noscript> tag from the Head Code to the Footer Code section in Webflow’s Project Settings to comply with HTML5 requirements.
  • Ensure you use the latest Facebook Pixel code with the <script> in the head and the <noscript> in the footer to maintain tracking and fix W3C validation errors.

You're seeing W3C validation errors due to the use of a <noscript> tag and possibly deprecated or improperly placed code from the Facebook Pixel in the <head> of your Webflow site.

1. Understand the W3C Error

  • The W3C validator often flags <noscript> in the <head> as invalid in HTML5.
  • Facebook Pixel commonly injects a <noscript> tag to support tracking for users with JavaScript disabled, but HTML5 only allows <noscript> inside the <body>.

2. Remove or Relocate the <noscript> Tag

  • Go to Project Settings in Webflow.
  • Under the Custom Code section, look at the Head Code box.
  • If you’ve added Facebook Pixel manually, you might have added a <noscript> block in the head, which is invalid.
  • Move the <noscript> code to the Before tag field instead (in the Footer Code section).
  • This location is valid for <noscript> and still functions properly for Facebook tracking.

3. Use Facebook’s Updated Pixel Code

  • Go to the Meta Events Manager and get the latest Facebook Pixel base code.
  • The valid structure has a <script> in the head and a fallback <noscript> in the body.
  • In Webflow:
  • Copy the script portion into Head Code.
  • Copy the <noscript> image tag into Footer Code.

4. Test for Validation Again

  • After making changes, re-publish your Webflow site.
  • Use the W3C Validator (https://validator.w3.org/) to check again.
  • Now that the <noscript> is in the right place, the validation error should be resolved.

Summary

To fix W3C validation errors with the Facebook Pixel on Webflow, move the <noscript> element from the Head to the Footer Code section in Project Settings, ensuring it's within the <body>. This placement complies with HTML5 rules and still allows Facebook tracking for users without JavaScript.

Rate this answer

Other Webflow Questions