Install Google Analytics on Your WordPress Website

There are several options available when installing Google Analytics on your WordPress website. Before proceeding with any of the below options you will need to have a Google Analytics account setup along with the tracking ID for your website.

Option 1: Edit Theme Template

Since you have full access to your website’s theme template files via the WordPress dashboard you can add the tracking code to your website directly.

  1. Login to your Google Analytics account.
  2. Click Admin.
  3. With the desired Property selected click Tracking Info.
  4. Copy the provided tracking code e.g.
    <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXX-Y']);
      (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  5. Login to your WordPress website.
  6. From your WordPress Dashboard select Appearance > Editor from the left menu.
  7. Click Header (header.php) from the Template files listed on the right.
  8. Paste the Google Analytics tracking code just before the closing </head> tag.

Option 2: Use a Plug-in

The other option is to use a plug-in to install Google Analytics on your WordPress account for you. There are numerous plug-ins available to do this, each with there own features.

We use Google Analytics Dashboard for WordPress which outputs statistics in the WordPress dashboard. For more information about this plug-in visit our recommended WordPress plug-in page for Google Analytics Dashboard for WordPress.


Scroll to Top