Setup Google Analytics For WordPress: The Only Guide You Need (No Plugin!)

Google Analytics is a powerful marketing analytics platform provided by Google for free. Marketing teams use GA to measure their traffic, where it’s coming from, what’s converting, and even what times throughout the day are most active! It’s a great source of information that drives decision making around website management and design. You can also setup Google Analytics for WordPress sites.

I was having trouble configuring GA on my own blog without the use of a plugin. After scouring through a few articles online, I was finally able to piece everything together and get GA on my blog. I am going to describe what I did to hopefully save you the hours I spent.

To configure GA, I completed the following steps:

  • Upgraded my WordPress account to a Business Plan – this is necessary because you need to be able to install themes in this guide
  • Create a Google Analytics account and generate your tracking code
  • Use an FTP client to access your site’s files
  • Edit your theme’s header file and add your tracking code to it

To get GA on your blog, consider if upgrading is worth it to you. I think for the cost of the plan and the potential to have powerful insights into your content strategy, it is definitely worth it if you are serious about creating a successful blog. To create a Google Analytics account, head over to the GA page and select ‘Start For Free.’

Google Analytics Home Page

You will need to then name your account, specify your site’s URL, what your using GA for, and what industry you’re in. After the initial steps, you will be brought to the Admin Dashboard, where you will see your GA tracking code! This is what you need to place in the head of your site’s HTML/php.

Google Analytics Tracking Code

Once you have your tracking code, you’ll need to edit the file’s theme. I am assuming if you are using WordPress, you are using many of the great themes the community, or WordPress themselves, have created. If you are using your own theme, you already know how to access and edit your files, so simply place the tag in your head and you are all set!

If you are using a theme, then you’ll need to get an FTP client to access your site’s files. FTP stands for File Transfer Protocol. The client will essentially allow you to explore your site’s file structure as if you were exploring it using your operating system’s file browser. Within your WordPress site files, you will see the files that makeup the theme you are using. You will need to edit these to add the GA tracking code in the head and get GA integrated to your site.

I used FileZilla, a free FTP client that will fulfill our requirement here. Download and install the FileZilla client to your local machine and boot it up. You will see the following screen:

FileZilla FTP Client

You will need to specify the host, username, password, and port for your site. Where do you find these? Good question! Go to your WordPress Site and click on ‘My Site’ and go to ‘Hosting Configuration,’ under ‘Manage:’

WordPress SFTP Credentials

Click ‘Create SFTP Crendentials’ and you will be given the information you need. Use the URL, username, password, and port you get in FileZilla and you will now be connected to your site’s files:

FileZilla FTP Connected

Go into your wp-content folder, and then to your themes folder. Here is where you will have to edit your theme’s header to get GA up and running. If you see the following icon next to your theme:

WordPress Themes In FTP Client

You have not installed the theme! This also means you cannot edit it. Head over to your admin view and install your theme from that page ([your site URL]/wp-admin/themes.php), and then activate it. Then, your icon will simply look like a folder without the arrow. When it is just a plain folder, you can go into the folder and find the ‘header.php’ file:

WordPress Theme header.php In FTP Client

This will open a text editor where you can finally paste your GA tracking code:

Add Google Analytics Tracking Code To header.php

Place it within the head! Save your file, and head over to your page! If everything was done correctly, you should see a site visit in your GA dashboard! You have now setup Google Analytics for WordPress!

Google Analytics Dashboard

Once you get the hang of the FTP client, you can also edit your themes using the ‘Theme Editor’ in your admin dashboard. Go to [your site URL]/wp-admin/theme-editor.php and you will see your themes and a similar file structure to the FTP client. Sometime’s it is not possible to edit theme’s in this view due to permissions, which the FTP client allow you to overwrite.

Leave a Reply

%d bloggers like this: