fbpx
Add Google Analytics to WordPress

3 Ways to Add Google Analytics to WordPress for Website Tracking

Google Analytics is one of the easiest ways to track and report your traffic on WordPress. This can be done either with a plugin or manually. Before we address both methods, though, let’s understand why anyone who runs a website should add Google Analytics to it.

The Importance of Adding Google Analytics to Your Website:

Once you start a blog, your main goal is to get more traffic and subscribers. According to WP Beginner, Google Analytics “help you make data-driven decisions by showing you the stats that matter.” With this, you can see the following 5 pieces of information:

  • Who visits your website?
  • What do people do when they are on your website?
  • When do people visit your website?
  • How do people find your website?
  • How do people interact with your content?

So we see that adding Google Analytics to your website in more than just an optional step. Doing this gives you opportunity to see the geographical location of your audience, where the users are going on your website and how long they stay (or don’t stay), the hottest hours in the day to post something, if people found your website through Google, Yahoo, Bing etc., which links users click on the most.

We highly recommend you take a look at this article by WP Beginners for additional details on Google Analytics and the impact in can have in boosting your website traffic organically.

Use a Google Analytics WordPress Plugin:

The simplest way for most WordPress users to add Google Analytics to your site is with a Google Analytics WordPress plugin. This method saves you from having to edit your website’s code.

To do this, we recommend two plugins: Site Kit by Google or GA Google Analytics.

SITE KIT BY GOOGLE

If you’d like to add Google Analytics to your WordPress site, Google has got you covered with a simple yet powerful plugin.

This free plugin connects Google Analytics to your WordPress site in just a few clicks but that’s not all. On top of analytics, this plugin pulls data from other services provided by Google, like Google Search Console, Google AdSense, and PageSpeed Insights allowing you to build a nice dashboard based on Google as your data source.

Here’s how to get started:

  • Install and activate the Site Kit by Google plugin, then click on the Start Setup button.
  • When done, you’ll be required to connect your WordPress site to your Analytics account.

As you might expect, you’ll need to go through a few steps to verify you’re the owner of the domain, grant access to Google to its data, and set up each service you’d like to add to WordPress.

When successfully connected with your Google account, you’ll be then able to see data from Google Analytics along with all other services activated directly in your WordPress dashboard.

All this data will always be reachable directly within WordPress in your left-hand sidebar.

If this plugin is too much for you and want to keep things focus primarily on Google Analytics, you could use the next plugin.

GA GOOGLE ANALYTICS

The free GA Google Analytics plugin has over 400,000 active installs and a five-star rating.

After you install and activate the Google Analytics WordPress plugin, all you have to do is add your Google Analytics tracking ID in its settings. To retrieve your tracking ID,

  • go to your Google Analytics account and click on Admin in the sidebar
  • Under Property, select Tracking Info, then click on Tracking Code
  • Your tracking ID will start with UA and be at the top of this section
  • In your WordPress dashboard, navigate to Settings > Google Analytics. Scroll down to Plugin Settings and add your tracking code in the relevant field

This plugin allows you to also choose whether you’d like the tracking code to be placed in your header vs footer, add custom tracking code, force SSL, disable tracking for your admin users, and a few other useful options.

Once tweaked to your needs, scroll down and click on the Save Changes button. Google Analytics should now be active on your WordPress site.

Read more about how Kinsta adds Google Analytics to websites here.

Enabling/Signing Up with Google Analytics on WordPress:

To get started, you’ll need to sign up on the Google Analytics site here. If you already used Google Analytics with other sites, you can create a new account in your existing Google account, according to WordPress.

  • In your Google Analytics account click Admin
  • Click Create Account to create a new profile for the site you want to add Analytics to
  • Fill in the “Account Name” for your new Google Analytics account.
    • You will see some data sharing options under “Account Data Sharing Settings.”
    • By default, all four Data Sharing settings are selected.
    • YYou can read the description for each setting to decide if you would like to opt out.
    • YWhen you’re ready, click Next.
    •  
    • On the Property Setup screen, fill in the following details:
      • Property Name: Enter a name for your property, such as your site title.
      • Reporting Time Zone: Choose the timezone you want the reporting of your website to be in.
      • Currency: Choose the currency of the location you normally operate in.
    • On the next screen, fill in your business information and click Create:
    • A pop-up will appear with “Google Analytics Terms of Service Agreement” and “Additional Terms Applicable to Data Shared with Google”. You will need to click the checkbox for both and accept the terms to continue.
    • You will then be presented with this screen asking you to choose a property: Choose Web and insert your website’s domain. Make sure to keep https:// selected. Type something in the Stream Name box (this can be your site’s title again) and click Create Stream.
    • Copy the measurement ID (top right corner) and go to Tools → Marketing → Traffic.
    • Paste the entire ID you copied from the Google Analytics site into the “Google Analytics Measurement ID” box. After you click “Save Settings” your site will be connected to Google Analytics and start sending data to Google.

    Using Code (header.php):

    There are a couple of ways to add Google Analytics to WordPress using the code snippet, but we’re going to be focusing on how to add the Google Analytics tracking code using the header.php file.

    • Navigate to the Theme Editor once again.
    • Open the Theme Header (header.php) file on the right column.
    • Paste the code snippet from this article’s code section in the header area or, more specifically, above the tag.
    • Once you’re done, click on the Update File button to save the changes.

    This option isn’t only the shortest, but also seems to be the easiest, as most of the “coding” relies on simply adding to the theme’s preexisting code.

    In Summary:
    There’s no doubt that Google Analytics is an incredibly powerful tool with tons of awesome features. Some of them are quite obvious and easy to use, others require some additional setup.

    Don’t miss out on this accessible, effective tool that’s designed specifically to help you improve your website SEO rankings and get more traffic.

    ARTICLES YOU MIGHT FIND HELPFUL:

    3 EASY WAYS TO EDIT A FOOTER IN WORDPRESS LIKE A PRO
    3 EASY WAYS TO INSTALL FONTS TO YOUR WORDPRESS WEBSITE
    5 SIMPLE WAYS TO CREATE ANCHOR TEXT LINKS IN WORDPRESS

Share this post