Many services, such as Google AdSense and Mailchimp, ask you to add code to the site header in order to verify your website, add content, or integrate some features. This guide will show you how to place this code on your website.
If you wish to verify your site or domain with Google Search Console, Bing, Pinterest, Yandex, or Facebook Business, you do not need to follow the steps in this guide. Instead, visit Tools → Marketing → Traffic (or Jetpack → Settings → Traffic if using WP-Admin) and scroll down to “Site verification” to access special tools to safely add the code without manipulating site files directly.
If you wish to verify your site with Google Analytics, you can follow these steps to Connect to Google Analytics.
This section of the guide applies to sites with the WordPress.com Business and Commerce plan, and the legacy Pro plan. If you have a Business plan, make sure to activate it. For sites on the Free, Personal, and Premium plans, upgrade your plan to access this feature.
To integrate your site with many popular services, you’ll often be asked to add code to your site’s header, between <head>
and </head>
tags, or in the theme editor or HTML header. The code helps that service recognize and communicate with your website. They ask you to add the code to the header because it will be on every site page.
Although each service’s instructions may vary, the following steps will ensure that the code is added to your site’s header in the correct place.
To add the code to your website header or footer, take the following steps:
- Install and activate the free Insert Headers and Footers plugin by WPCode.
- On the left-hand side of your dashboard, navigate to Code Snippets → Header & Footer.
- Paste the code into the Header or Footer box and click the “Save Changes” button:
The steps above will work with any tool that requires you to add code to the header of your site. Popular services that require this include:
- Google AdSense
- Mailchimp Pop-ups
- Meta Pixel (Formerly Facebook Pixel)
- … and many more.