The Definitive Guide to Google Analytics Enhanced Ecommerce
The Definitive Guide to Google Analytics Enhanced Ecommerce
A Simple Guide to Site Search Tracking in Google Analytics
A Simple Guide to Site Search Tracking in Google Analytics

How to Set up Google Analytics on Your Site the Right Way

How to Set up Google Analytics on Your Site the Right Way

Google Analytics is a powerful online tool that provides insights on what visitors to your site are doing. You know this already,  now you want to get started using it. Before you can begin tracking visitors and gaining insights, you need to set up Analytics for your site or sites.

To set up Google Analytics you need to install a bit of code on your site. You can do this manually, or use a plugin that works for your Content Management System (CMS). That means something like WordPress or Shopify. Read on, and you’ll find out how to correctly set up Google Analytics using either of these two methods.

Previous articles in the Google Analytics Guide:

  1. An Introduction to Google Analytics (GA3) Universal Analytics

Quick Jump To: 

1. Setting Up Your Google Analytics Account

a. Create your Google account
b. Create a Google Analytics property

2. How to Install Your Tracking Code

a. Installing Code Manually
b. Installing tracking code manually on WordPress
c. Using Plugins to Setup Google Analytics

3. Common Google Analytics Setup Problems

a. Broken or Duplicate Tracking Code
b. Unlinked Google Accounts

4. Conclusion


Setting Up Your Google Analytics Account

Getting started with Google Analytics is straightforward. First, you need to either login to or set up your main Google account. If you’ve already got an account you use for Gmail, Google Drive or other similar services, it’s fine to use that.

Create your Google account

If you don’t have a Google designated account you’ll need to get one. Simply head to, and you’ll see the following form to fill out to get your account: 

google sign up form

Once you’re signed up and signed in to Google, you can get started with Analytics. Head to the Google Analytics website, and you’ll see the following page:

set up google analytics

You need to press the blue ‘Start Measuring’ button to get taken to a page where you need to input an account name, and set your preferred data sharing settings. Google likes to collect anonymized data for future analysis. If you want to limit where your analytics information is shared you can untick the respective boxes. Keep in mind that your account name can be the same as the name of the website you’re going to track. 

Create a Google Analytics property

Types of data to measure in google analytics

Google Analytics can be set up in different ways according to your needs. You can use it to track a set of ecommerce sites, multiple apps, or even a simple blog. For the sake of this simple guide to setup, let’s assume the Analytics account you want to create is to track just one website. In that case, you’ll want to choose the ‘Web’ option.   

After clicking ‘Next’, you’re ready to start sharing information about the site you wish to track. That includes the website name, URL, and industry. The fields in which to enter the various pieces of information are clearly displayed. Analytics calls this part of the process ‘creating a property’. 


setting up a property in google analytics

Once you’ve created your Property, Analytics will display your unique Tracking ID. That’s what Google uses to identify your site. A little further down the page, you’ll also see your ‘Global Site Tag’. That’s the piece of code that lets Google Analytics collect data from visitors to your site, and is shown in the screenshot below. To activate Google Analytics you need to install the code on your site.

How to Install Your Tracking Code

The tracking code you accessed needs to be installed on every page of your website. As mentioned earlier, there are two ways that you can do this. The first section will cover how to install the code manually. In the second section, we’ll cover common plugins you can use for WordPress and Shopify.

Installing Code Manually

The way you install the Analytics code will change depending on your website. If a web designer built a custom site for you with HTML files, you need to add the code to those files. The best place to insert this is immediately after the <head> tag on each page. The header is the top section of your website, which appears on every page of your website. 

You might want to make a change to your code through a text editor program. You can then upload it to your web host. This can be a complex process and there are different approaches based on the platform you are using to manage your site.

Installing tracking code manually on WordPress

There is a good chance that your website isn’t a custom design. The most popular content management system on the net is WordPress. If you are using WordPress you can insert the Google Analytics code on your site through the Appearance tab, and then Theme Editor on the main menu.

Most WordPress themes include a Theme Header. The file will be called header.php and should be easy enough to find. When you click on the file you want to search for the <head> tag. Then do a quick search for the term with Command + F on a Mac or Control + F on a PC.

You then want to insert your Google Analytics code after the > sign. You can see an example of this in the screenshot below.

inserting your global site tag into your wordpress theme

A less technical way of inserting Google Analytics into your WordPress website is through a plugin. This method will be covered in the next section.

Most CMS have an intuitive system for installing Google Analytics. For example, adding the code to a Shopify site is nice and simple. Once you’re logged in, choose the ‘Online Store’ option from the menu down the left-hand side of the interface. You will then see a clear and obvious panel where you can paste your tracking code.

Using Plugins to Setup Google Analytics

You don’t have to install your tracking code manually. You can use plugins to get Google Analytics up and running instead. Plugins are add-ons to WordPress for your site, which allow you to do different things. There are many different plugins available which you can use to add Analytics to your site in a few clicks.

Using Plugins to Setup Google Analytics

You can find the available plugins by searching ‘Google Analytics’ on the main WordPress plugins page. You’ll then want to select and install your chosen plugin. For the sake of the rest of this guide, let’s assume you chose the ‘MonsterInsights’ plugin. It’s the most popular of the plugins and the process of getting it up and running is pretty representative.

Once you’ve installed and activated the plugin, head to your site’s WordPress dashboard. There will now be a new menu item titled ‘Insights’. When you click it, you’ll be able to navigate to a ‘Settings’ menu. In that menu, you’ll find an ‘Authenticate with your Google Account’ button. Click it. That will redirect you to Google Analytics.

Analytics will ask you to sign in (if you’re not) and to give permission for the plugin to access your data. Once you give permission, you can then select the account you want to link to your new plugin. Following a few more on-screen instructions will then take you to the end of the process. 

Common Google Analytics Setup Problems

Setting up Google Analytics for your site isn’t all that complicated. That should be your main takeaway from what you’ve read so far. There are, though, some Google Analytics problems that you might encounter along the way.

Broken or Duplicate Tracking Code

The most common issues with setting up Analytics stem from how you install the tracking code. If you don’t add the exact code given to you by Analytics, your setup won’t work. A simple copy and paste error when manually installing the code can render the code useless.

There can also be conflicts between different Google tools and your website. For example, as you’re interested in tracking site data, you might have looked to use Google Tag Manager. It’s another Google tool for site owners. 

If you have applied Google Tag Manager tracking code to your site, you shouldn’t also need to add Analytics tracking code manually. Tag Manager and Analytics both use the same code to collect data. Having both installed means you could be doubling up on collected data. 

Unlinked Google Accounts

Once you’ve got Analytics up and running, it pays to link your account to any other Google tools you use. Many new Analytics users fail to realize that this is possible or how useful it can be. Linking Google Analytics and Google Ads, for instance, is worthwhile.

If you don’t link those tools, you have to assess them independently. That takes longer and is less efficient. It makes sense to save yourself time and effort. Any pay per click (PPC) advertising you do via Ads, too, is intrinsically linked to your web traffic. The point of advertising is to drive traffic to your site. Linking Ads to Analytics lets you better assess how well your campaigns are doing that.

Furthermore, there are is vast selection of Google Analytics tools out there to use. We highly recommend researching and using these to optimize your GA experience. In almost all cases, they are completely free to use as well!


Setting up Google Analytics is pretty simple. Depending on how you’ve built your site, you can do it in a handful of minutes with only a few clicks. Creating an Analytics account is as easy as filling in a few on-screen fields. That gives you the tracking code that lets Analytics work on your site.

To get started tracking site visitors, all that’s left is to add that code to your site. You can do that with a bit of simple copy and paste, or by installing a ready-made plugin. As long as you’re careful to keep the code intact and to add it only where needed, you’re ready to go.

Phil Pearce
Follow me
0 0 votes
Article Rating
Phil Pearce
Phil Pearce
Phil is an analytics expert, author, and web analyst. He's also the Analytics Director & Founder of Google Analytics, Google Tag Manager, Google Ads and CRO agency, MeasureMinds Group. Over the past 20+ years, Phil has helped clients improve their analytics and search engine marketing through the introduction of new tools and disruptive techniques.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x