This blog post is part of your WordPress series which shows you how to install and manage a WordPress blog or websites.

To read previous blog posts in this series, please click here, here and here.

This short tutorial is going to show you how to quickly Google Analytics tracking code to your WordPress blogs or websites so you can track events on your sites. Using this code, you’ll be able to view how many visitors or hits you get on your sites as well as pages viewed and clicked on. It’s a great tool to install and the best thing about it  is, it’s free!

So, without wasting anymore of your time, lets’ get going.

Objectives:

  • Add Google Analytics Tracking Code To Your WordPress Blog
  • Enjoy!

 

To get started, the first thing you’ll need to do is register for a free account on this site. Or visit www.google.com/analytics

 

After registering and confirming your email address, you’ll be taken to Analytics to create a new profile. Fill out your site’s information and agree to the agreement.

 

analytics_wordpress

 

Next, you’ll be given a piece of code to add to your site. Copy the entire code in the box shown, then open your favorite file editor. If you don’t have an editor installed, please read this post to learn how to install one in Ubuntu. Using Komodo Edits as well as its build-in FTP client, you can manage your blog files easily.

 

analytics_wordpress_1

 

When Komodo Edit opens, launch the FTP client and browse to /var/www/myblog.com/wp-content/themes/Your_Themes/ then look for and double-click ‘header.php’ to open.

 

analytics_wordpress_2

 

After opening header.php files, paste the code just before the </head> tag line in the file and save it.

 

analytics_wordpress_3

 

 

After few hours or a day go back to Analytics and login and you’ll see some stats about your site.

 

Again, it’s always nice to have an file editor installed, that why I showed you how to install Komodo Edits in Ubuntu. Reference it to learn how to install it.

 

If you can’t edit the file because of permissions issues, change the permission on the file before editing.

 

Enjoy!

Frequently Asked Questions

How do I add Google Analytics tracking code in Wordpress?

To add Google Analytics tracking code in Wordpress, you need to register for a free account on Google Analytics, create a new profile, and then insert the provided tracking code into your Wordpress site's header.php file before the </head> tag.

What are the benefits of adding Google Analytics tracking code to my Wordpress site?

By adding Google Analytics tracking code to your Wordpress site, you can track visitor numbers, page views, clicks, and other events on your site. It provides valuable insights into your site's performance and helps in making data-driven decisions.

Where can I find the Google Analytics tracking code for my Wordpress site?

After registering and setting up a new profile on Google Analytics, you can find the tracking code provided by Google Analytics. Simply copy the code and paste it into your Wordpress site's header.php file.

Can I use Google Analytics tracking code on multiple Wordpress sites?

Yes, you can use the same Google Analytics tracking code on multiple Wordpress sites. Just make sure to insert the code into the header.php file of each site before the </head> tag.

How long does it take for Google Analytics to start tracking data on my Wordpress site?

After adding the Google Analytics tracking code to your Wordpress site, it may take a few hours or up to a day for Google Analytics to start tracking data. Be patient and check back on your Analytics dashboard.

Do I need to have coding knowledge to add Google Analytics tracking code to my Wordpress site?

You don't need advanced coding knowledge to add Google Analytics tracking code to your Wordpress site. Simply follow the provided instructions to copy and paste the tracking code into the header.php file.

What happens if I forget to add the Google Analytics tracking code to my Wordpress site?

If you forget to add the Google Analytics tracking code to your Wordpress site, you won't be able to track visitor data, page views, or other important metrics. It's essential for monitoring and improving your site's performance.

Can I track specific events on my Wordpress site using Google Analytics?

Yes, you can track specific events on your Wordpress site using Google Analytics by setting up event tracking in your Analytics account. This allows you to monitor interactions like button clicks, form submissions, and more.