How to Add Google Analytics to WordPress in Three Simple Steps

This article shows you how to add Google Analytics to WordPress with minimal fuss and very little effort.

Step One: Get a Google Analytics account

If you haven’t already signed up for analytics, you’ll need to venture over to Google and get hooked up with a free account. Don’t worry, it’s quick and painless.

Once you’ve completed the sign up process, you’ll be given a piece of JavaScript code. It looks like this:

Google-Analytics

This code allows Google to gather anonymous data on how your website is being used

Step Two: Add the Google Analytics code to your WordPress theme

To do this, you’ll need to open up the footer.php file of your WordPress theme. You can either use an FTP client to access your server, or edit your theme files directly from the WordPress dashboard. Your file editor is located under the ‘Appearance’ tab in the sidebar menu.

Adding-Google-analytics-code

In the list of template files to the right of the text editor, find footer.php and open it. To add Google Analytics to WordPress, you now just need to copy and paste your code immediately before the closing </body> tag. Like so:

How-to-add-analytics-code-to-footer

 

Make sure you save your footer.php file once you’ve pasted in the new code. Google Analytics should now be able to track every page of your WordPress site and provide you with that sweet juicy data.

Step Three: Double check that your analytics is working

To make sure that the script has installed correctly, go back to your Google Analytics home page and click the admin panel in the top right corner of the screen. Open the relevant account, and click the ‘tracking code’ panel. If the Tracking Status is ‘Receiving Data’, then you’ve successfully added Google Analytics to your WordPress site.

Check-Google-Analytics-status

Alternatively, use a Google Analytics plugin

If you’re not comfortable hacking around in your WordPress template files, or you want to explore some additional options and functionality, you can also add Google Analytics to WordPress with the use of a plugin. These plugins will typically give you an interface in your WordPress dashboard where you can add the code directly, without having to delve into your theme files.

There are quite a few Google Analytics plugins to choose from, and I wouldn’t necessarily recommend one over the others. Have a look for yourself in the WordPress plugin directory. If you have a multi-site solution, I would also suggest checking out WPMU Dev’sMultisite Google Analytics plugin.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s