The Beginner’s Guide to Install Google Analytics on WordPress

2 minutes read

Google Analytics is no doubt the best way on earth to track a website’s traffic and conversions. It costs nothing and it’s easy-to-install. To start tracking the traffic stats, all you need to do is register, add your site, and install it’s tracking code onto the site.

Note: This post is about installing Google Analytics on WordPress. If you are new to this service, learn using it here.

With WordPress, adding tracking code becomes somewhat difficult for users with no programming background. I don’t really recommend to rely on installing a plugin particularly for this purpose. In this guide, I’m sharing with you how I install Google Analytics tracking code on my or my buddies’ WordPress sites.

With the help of a plugin

If you are not comfortable with coding, you might need help of a plugin to install analytics. The only robust plugin I know to do that is Google Analytics by Yoast.

After installing the plugin, you need to authenticate your Google Analytics account with the plugin, select your site from the list so obtained, and you’re done!

The plugin provides a great number of options to setup, customize, and optimize the tracking. Have a look at the capture of General Settings of the plugin:

Yoast's Google Analytics for WordPress

Check out more plugin screenshot here.

Google Analytics manual installation

If you don’t want to use a plugin, the other way to install analytics is to add the tracking code manually into the code of your WordPress theme. For those who like to fork the code, here is the quick-and-easy workaround to grab the code and add it in your theme.

Note: With manual installation, you’ll need to repeat this process with every new theme you install in/apply to your WordPress. Make sure you have a backup of your WordPress theme before proceeding further, so that you may recover to a working version in case if anything went wrong.

Steps

You are just 3-steps OR 2 minutes away from manually integrating Google Analytics with your WordPress. Here you go:

  1. As you add a site in your Analytics account, you get a tracking code to put on your that site. Copy this code:
    Google Analytics Tracking code
  2. Now in your WordPress dashboard, head over to Theme Editor in the Appearance section.
    The WordPress theme editor
  3. Click header.php and look for </head> (the closing HTML head tag) and paste the copied tracking code just above it. Follow as shown in the below screenshot:
    Adding Google Analytics Tracking code in WordPress theme

    Finally, update the file.

That’s pretty much it. Feel free to ask questions if you’ve got stuck anywhere. Hope you found this useful.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

To access the Google Merchandise Store Analytics, you need to follow these steps:Open your web browser and visit the Google Analytics website (https://analytics.google.com/).Sign in to your Google account. Make sure you use the same account associated with the...
Google Analytics 4 (GA4) is the latest version of Google&#39;s web analytics platform. It offers enhanced features and capabilities compared to its predecessor, Universal Analytics. Here&#39;s a general overview of how to use Google Analytics 4:Set up a Google...
Analyzing website visits in Google Analytics can provide valuable insights into the performance and user behavior on your website. Here are the steps to analyze website visits in Google Analytics:Sign in to your Google Analytics account: Go to the Google Analy...