How to Add Google Analytics to a WordPress Website

Mutual Funds SIP

In this post learn about how to add Google Analytics to a WordPress website. Google Analytics allows webmasters to track and analyze a website’s traffic. You can connect a WordPress site to a Google Analytics account in multiple ways.

  1. Add Google Analytics to WordPress without plugin
  2. Add Google Analytics to WordPress with a plugin

1. Add Google Analytics to WordPress without plugin

You can track your WordPress site in Google analytics by adding the tracking code to the header of your WordPress theme.

Note: You must have a Google Analytics account before you begin the following setup. If you don’t have an account, then you will need to create an account.

Get a .com now from $4.99*/yr with GoDaddy!
  1. Access your Google Analytics account and copy your tracking code snippet.
  2. Access your WordPress files via hosting or FTP.
  3. Navigate to the /wp-content/themes folder for your WordPress site.
  4. Open the folder for the theme you are currently using on your site.
  5. Open and edit the header.php file. If your theme does not have a file named header.php, then you will need to locate and edit the file that contains the wp_head() code.
  6. Paste your tracking code snippit just before the following code.

    <?php wp_head();

  7. Save and upload the updated file.
  8. Visit your site so that traffic is recorded in your Google Analytics account.
  9. Check your Google Analytics reporting to confirm the file was correctly updated.

2. Add Google Analytics to WordPress with a plugin

You can set up your WordPress site with Google analytics using a plugin, instead of manually entering the tracking code into your files. A plugin that helps with this process is the Google Analytics for WordPress by MonsterInsights plugin. Remember, whenever you’re deciding on a new plugin be sure to check the developer’s page to determine if they’re still maintaining the plugin with updates.

If you don’t already have a Google Analytics account setup, then you will first need to create an account.

Get up to 30% off all new products with GoDaddy!
  1. Log in to WordPress.
  2. Install & Activate the plugin. Follow the YouTube video Plugin | Step by step video on How to Install & Activate a WordPress Plugin | Hosting Column.
  3. Locate the new sub menu in your main Settings menu labeled Insights, and click it.
  4. Click Settings under Insights.
  5. Then click Authenticate with your Google Account.
  6. Now click Next.
  7. And then click Click to Get Google Code
  8. If necessary, login to your Google account when prompted.
  9. Click Allow
  10. Copy the code that is provided.
  11. Return to the browser window with your Insights settings and paste the code where it says “Paste Google Code Here“.
  12. Click Next.
  13. Select the Google Analytics profile you want to use.
  14. Click Next.
  15. Click Close.

In these ways, you can add Google Analytics to your WordPress website and start monitoring your website’s traffic.

Thanks for visiting, do browse ads shown in this post to get the various offers, deals, discounts on amazing products & services. For queries & suggestions, mails are welcome on

Subscribe to Hosting Column for latest updates and video articles. Web Hosting $3.95   Hostinger