How to Add 3rd Party Scripts to Your WordPress site

There are various reasons you may need to add 3rd party scripts and snippets of code to your site. For example to include code that will let Google Analytics track user behavior or just to confirm you’re the genuine owner of your site to integrate with a platform like Pinterest.

There are quite a few free plugins that can help you do this, but I think Header Footer Code Manager ( is easiest to use of the most popular plugins for inserting code snippets.

Unlike some other plugins, Header Footer Code Manager lets you add each piece of 3rd party code as an individual snippet. This is handy as it makes it easy to disable a piece of code if you need to remove it for a period of time, without affecting other snippets.

The New Snippet form should be quite intuitive. Leave Site Display set to Site Wide to ensure the snippet appears on every page.

Perhaps one aspect to clarify is the Location dropdown control. Most 3rd party scripts will specify where they should be placed in the page.

Obviously if the location specified is the header, then set Location to Header.

Some scripts will specify the location as the footer, but if a script is meant to be inserted before the closing </body> tag, the Location should also be set to Footer.

Some other scripts specify they should be placed after the opening <body> tag. In that case, set the Location to Before Content.


Finally, don’t forget to insert the code into the Snippet / Code box and click the Save button.

After saving a snippet, always check your site to make sure it’s still working correctly. If you miss just one character from a piece of code, it could cause your site to break or parts of your pages to display oddly. Ideally check your site in Incognito or Private Browsing mode.

You might just be able to make out in the screenshot above that I added the Google Analytics tracking code. This used to be the only way to install Analytics, there’s now an easier way which I’ll show you shortly.