Do you know you can try any of our premium WordPress themes for free?Show me the themes
How to add Google Analytics to WordPress

How to add Google Analytics to WordPress


Having a Google Analytics in WordPress and any other CMS is one of the most important things you need to do. Why? Not having it will disable you from having clear focus and vision where you are and where you need to be. Let me explain this little more.

Google Analytics basics

First things first, let’s talk some more about Google Analytics. The go-to service you need for insights on all the valuable data which help you make your online presence that much better.

Google Analytics is, by far, the best analytic tool, a service for your website. A tool that tracks visits and performance of your site, gives you valuable insights on how your online efforts are performing. And, did I mention it’s free? Add tracking code to WordPress and you’ll have powerful information that only improves your business efforts. Data like:

Top WP Hosting recommended by Meks
  • how many people are visiting your website,
  • demographic,
  • where are they coming from,
  • how are they finding you,
  • what kind of engagement they have

and similar type of things that can help you shape better strategy and plans.

man's hands on laptop

An example

All this info is there to help you present yourselves and your business in the best possible way. Let’s say, for instance, you have a video type of business, where you show your products and services through short video forms. So, you invested all that time, money, effort and work into creating original, fun and unique clips to present your business and you still have results you wanted, people are bouncing out from your website in a matter of seconds. And why? Having a Google Analytics may help you there by showing that, perhaps, the majority of your visitors come from mobile devices and your website isn’t well optimized. So, just by knowing that information, the fact that your visitors are using mobile phones to come to you can not only help you but change your business strategy for the better and boost your productivity. Because, as we show in our 2017 WordPress Themes Customer Survey report, a responsive website is one of most essential things every WordPress theme and business should have. And this is just one of the reasons why it’s important to have Google Analytics in WordPress websites and blogs.

How to install google analytics WordPress

Now that we know all that, it’s time to explain setting up google analytics on WordPress. You can do it two ways: manually and with the use of plugins. No matter what method you use, one thing is the same – you need to create a Gmail account which is your way to enter Google Analytics and set up the account there. Once you do all that and enter all required information (a type of property, website name, and URL, industry category, etc.), you will get your GA tracking code. This code you need to implement in your WordPress site in order to have access to all the insights mentioned above.

1. Add Google Analytics to WordPress manually

This option is a harder one since it requires you to have some coding knowledge. In order to set up GA tracking code in WordPress manually, you need to copy the code from your GA account and paste it into your WordPress site. You’ll do that by logging to your WP dashboard and clicking on Appearance >> Editor.

add google analytics manually in wordpress step one

Once you get in, click the header.php file and paste the tracking code after the tag. After that, you click on the Update file button, and you’re ready to go.

add google analytics in wordpress manually step two

Bonus tip

In case you don’t know or want to mess with codes, there’s another way how to add Google Analytics code to WordPress. Use Analytics Cat, a free Google Analytics WordPress plugin that sets up code within a minutes! All you need to do after installation is to go to the Google Analytics Manager to complete the setup. Once you’re there, just type your Google Analytics ID and choose which users to exclude from tracking:


and you’re done!

2. Google Analytics plugin WordPress

The other way of implementing Google Analytics code in WordPress is to use plugins. Easier and quicker way for sure. I personally use MonsterInsights plugin, but you can find many others like Google Analytics Dashboard for WordPressAnalytify Google Analytics DashboardGoogle Analytics+ and more.

Anyway, Google Analytics WordPress plugin is excellent and safe way for skipping codes. For all of you who don’t know how to code or, just, don’t need to go through the manual process. This is how you do it, in 3 easy steps:

  1. download and install the plugin,
  2. activate it from your dashboard,
  3. paste the GA Tracking ID Code into the plugin

and you’re good to go! What’s also good – you get to see the Google Analytics insights straight from your WordPress dashboard – cool, right?

google analytics in wordpress dashboard with plugin

There you have it. All the info you need to add Google Analytics to a WordPress site or blog by yourselves. Hope this helps understand both how to do it, and why it’s so important to have one on your site.


Tags: ,

Ivana Cirkovic

Ivana is a Digital Marketing, PR and Social Media consultant with over nine years experience in the field. She is also a WordPress enthusiast and an active member of WordPress community who lives online almost 24/7. In love with Twitter, WP, photography and NYC.

Try theme now for free!
  • Access to a copy of the demo website
  • Full access to the theme options
  • No credit card required

* We will send you an occasional newsletter with special offers, news & theme updates but you can unsubscribe at any time.