While building your site on WordPress, you've probably come across the phrase "insert this code into your header". This instruction is fairly vague, but luckily it's not complicated. Learning how to insert header code is fairly essential for a a small business website. If you want to track your website traffic using Google Analytics, verify your site with Pinterest or embed fonts from Google, knowing how to insert header code is essential.
Luckily, this is actually a pretty straightforward process, and you don't even need to learn a single bit of HTML (if you don't want to). Most CMS platforms have a simple way to insert header code that is safe to use and unlikely to bring down your site.
WordPress: Insert Header Code Using a Plugin
In WordPress, you can insert header code using the PHP files in your CPanel, or by accessing your theme's files via the Editor. This requires a reasonable knowledge of coding, so I wouldn't recommend this route for beginners. So let's take a look at how, in WordPress, we can insert header code without accessing any PHP or theme files. This can be achieved by installing a simple but incredibly useful plugin, helpfully called "Insert Headers and Footers". This is a great option because the plugin will remain in place when updating or changing your theme, so nothing will be erased by accident!
Once you've installed this plugin, hover over "Settings" in the left hand sidebar in your WordPress dashboard. You should now see "Insert Headers and Footers" in the pull out menu. Click on this option, insert your header code and click save. Voila!
Squarespace: Insert Header Code Using Code Injection
User-friendly Squarespace provides an easy way to insert header code via it's Advanced Settings. Keep in mind that Squarespace recommends you only use Code Injection if you have some coding knowledge. Any custom code falls outside the scope of Squarespace support. However, if you're simply copying and pasting code from Google Analytics or a domain verification script from Pinterest, you shouldn't encounter any issues. This warning would mostly apply to anyone trying to write and insert their own script.
- Open Code Injection by travelling to the Home Menu, and clicking on Settings > Advanced > Code Injection
- Add valid HTML or scripts into the appropriate Code Injection fields. When copying and pasting script, it will usually tell you the optimal place to put it, but it's usually the Header.
- Now click Save and you're done!
Weebly: Insert Header Code Using the Site Editor
Inserting header code in Weebly is incredibly straightforward as well.
- Login to Weebly and select the website you wish add the header code to
- Click Edit
- Under the top menu, click on Settings, then select SEO from the left sidebar
- Insert the valid HTML or scripts into the appropriate field, whether that's header or footer.
- Click Save, and you're done!
So there you have it! Whether you're working in WordPress, Squarespace or Weebly, inserting a header code needn't be complicated.
Let me know below if you have any alternative methods or if you'd like me to add instructions for your CMS platform!
Cheers, Laura x
Interested in launching your website with WordPress? First make sure you know the difference between the dot com and dot org versions of WordPress!
Already decided to go ahead with WordPress? Follow my 5 Easy Steps to Go Live ASAP, or check out the 8 Things You Should Do Before Hitting Publish.
Ready for a website that reflects who you truly are?
Gain clarity in your digital presence, be confident in your messaging and save time in your business, with website design that engages users and reflects who you truly are.
My Website Design package will give you a beautiful, functional website that allows you to feel confident in your brand and build a real connection with your audience.