How to add Google Analytics or any code to WordPress

Note: “Add Google Analytics (or any code) to WordPress” was originally posted on the Racine WordPress Meetup website.

There are many ways to insert codes like Google Analytics to your WordPress website. The method you choose will depend on your level of expertise and the plugins and theme that you are currently using.

Methods for adding Analytics to WordPress

Like most tasks in WordPress, there are many ways to achieve what you need. You could use your theme, a plugin, or edit your theme manually. Generally, adding code with a theme or a plugin is considered easy to accomplish, while editing your theme should be left to advanced WordPress users.

Using a reliable plugin to add code is the easiest solution

  1. Add code to WordPress using a plugin (easy to intermediate)*
  2. Add code to WordPress by editing your theme code (advanced)

Plugins to add code to WordPress

I’ve made a list of well-maintained and supported WordPress plugins that allow you to add code to your website.

Adding Executable PHP to WordPress

If you need to run PHP in WordPress, then make sure that the solution you choose works on more than just Google Analytics. Some plugins, like GeneratePress Premium allow for executable PHP. (You will, however, need to use the GeneratePress theme.)


Share on facebook
Share on twitter
Share on linkedin

Table of Contents

On Key

Related Posts