Learning Goals
At the end of this Tutorial you will be able to:
- Sign up to the free Google Analytics service.
- Create the Google Analytics Tracking Code for a particular website.
- Copy-and-paste the Tracking Code into a web page or pages.
- Test that Google Analytics is tracking visits to a web page.
- Understand these Google Analytics terms: Account, Property and View.
- View a Tracking Code you created previously in Google Analytics.
- Share Google Analytics web traffic data with others, such as your work colleagues and clients.
You will need a Gmail or other Google Account to complete this Tutorial.
About Google Analytics
Google Analytics is an online service used by some 27 million websites around the world to monitor their user traffic.
- For websites with over 10 million visits per month, there is a paid version named Google Analytics 360 that costs $150,000 annually.
- This Tutorial will focus only on the free or ‘standard’ version of Google Analytics.
To use Google Analytics on your website, you:
- Sign in to Google Analytics with the same email and password you use to access Gmail, YouTube or other Google service.
- Enter the address of the website you want to track – for example:
https://marysmith.github.io
- Google Analytics then generates a Tracking Code which contains a Tracking ID that is unique to your website.
- Paste the Tracking Code into all the pages of your website you want to monitor.
The Google Tracking Code is in the form of a few lines (a snippet) of JavaScript code. Typically, the Google Analytics Tracking Code is placed just before the closing </head> tag of a web page.
Information collected by Google Analytics
Google Analytics provides you with two types of data about the traffic to your website:
- A little about what is happening now: You can see a summary of so-called real-time data, such as your number of current visitors, their geographic location and which pages they are viewing.
- A lot about what happened until the day before yesterday: You can view more in-depth details on all previous activity on your website. This includes anonymised statistical data on your website visitors, such as their age range, gender and lifestyle interests.
However, the free version of Google Analytics delays the display of historical data by 24-48 hours. This means that you won’t see any web traffic from yesterday and often from the day before either. So, do not be alarmed if it looks like the number of website visitors over the past two days has dropped to zero. It is just that Google Analytics is not yet displaying that data.
Your Gmail/Google Account
Do you already use one or more of Google’s online services, such as Gmail, Google Drive, YouTube, Google Maps or Google Play? If you do, you will know that you can sign in to any of these services using the same email address and password. This email/password combination is known as your Google Account.
Because Gmail is Google’s most widely-used service, the terms ‘Gmail Account’ and ‘Google Account’ are often used interchangeably.
You need a Gmail/Google Account to sign up to Google Analytics and complete this Tutorial. If you do not already have such an account, follow the instructions at the link below.
You can have more than one Gmail/Google Account.
Signing up to Google Analytics
Follow the steps below to sign up as a user of Google Analytics.
- Use your web browser to go to this web address:
https://www.google.com/analytics
A new tab will open in your web browser to display a welcome screen like that below. Near the top-right of the screen is a button named Start for free. Click on it.
- You are next asked to sign in to Google Analytics. Enter the same details as you would when signing in to Gmail or other Google Account.
- First, type your Email address and click the Next button.
- And then enter your Password and click Next again.
- You will be shown a screen that introduces you to Google Analytics. Click the Sign up button at the right of this screen.
You have now used your Gmail/Google Account to sign up as a user of Google Analytics. Your next action is to provide Google Analytics with details of the website you want to track.
Creating a Google Analytics Account and Property
After you have completed the sign-up steps in the previous section, Google Analytics displays a screen named Accounts that begins with two sub-headings:
- Setting up your account: An Account is a group of tracked websites. Any one Account can contain up to 100 tracked websites.
- Setting up your property: A Property is a single tracked website. Every Property belongs to an Account.
The terms Account and Property are explained later in this Tutorial.
Here is how to create your first Account and Property in Google Analytics.
- You can use Google Analytics to track either a website or a mobile phone app. Leave the first setting at its default value of Website.
- You are now asked to enter the Account Name and Website Name. In the example below, the values ‘My Personal Websites’ and ‘GitHub Website’ are entered.
- The next two values you enter are under the sub-heading of Setting up your property, In Google Analytics, a Property is a single tracked website (or mobile phone app). Google Analytics can track a website only if you:
- Correctly select the protocol (http:// or https://). It is unlikely you will ever want to select http://, as this is the older, insecure protocol that should not be used on modern websites.
- Correctly enter the website address (such as marysmith.github.io). Do not enter a forward slash after the web address, or include the name of a folder within the address. For example, marysmith.github.io/ or marysmith.github.io/portfolio.
- Here are the two steps:
- At the right of the Website URL field, click the dropdown arrow and select https://.
- Next, in the Website URL field, type the web address of your website. URL (Uniform Resource Locator) is simply another term for web address.
- The next two fields under the Property sub-heading are optional. You can ignore them or select a value for Industry Category and amend the default Reporting Time Zone.
You have now completed the first two sections of this screen: Setting up your account and Setting up your property. The next section is named Data Sharing Settings.
- You are now shown a list of options for how you want to share your website’ traffic data with Google. All the options are selected by default. You deselect one or more if you wish.
- When finished, click the Get Tracking ID button.
- Google Analytics now displays its Terms of Service Agreement.
- At the top of this screen, select your country.
- Next, select any checkboxes contained within the text of the Agreement.
When finished, click the I Accept button at the bottom.
- You are now shown the Google Analytics Tracking Code with the unique Tracking ID for your website.
If you click anywhere within the Tracking Code area of the screen, Google Analytics selects the code. Next, right-click with the mouse and, from the pop-up menu displayed, choose the Copy command. You can then paste the Google Analytics Tracking Code into your web page or pages.
Pasting your Google Analytics Code into a web page
You will need to paste the Google Analytics Tracking Code with its unique Tracking ID into every web page on your website that you want to track.
- Copy the Tracking Code from Google Analytics – or from a web page that already contains it.
- In your text editor, open the web page into which you want to paste the Tracking Code.
- Typically, the Tracking Code is placed just before the closing </head> tag.
In your web page, click in that position, press ENTER once or twice to open a new line or two.
- And then paste the Google Analytics Tracking Code.
When finished, you will need to save your web pages and upload them to your website on the Internet. Google Analytics cannot track web pages that exist only on your local computer.
Google Analytics: Accounts, Properties and Views
To correctly set up and manage Google Analytics for several websites, it is important to understand the following key terms:
- Google Analytics Account
- Google Analytics Property
- Google Analytics View
About Google Analytics Accounts
You sign in to Google Analytics with your Gmail/Google Account – a combination of an email address and password that gives you access to the online service. Once you have signed in, however, the word ‘Account’ you see on Google Analytics screens has a very different meaning.
Within Google Analytics, the word ‘Account:
- Does not refer to the Gmail/Google Account you used to sign in.
- Does refer to the client for whom you are building websites.
When you build several websites with different web addresses for a single client, you can group these different websites together into one, convenient Google Account.
In other words, a Google Analytics Account is a group of tracked websites that share something in common. Typically, that common factor is that they were all created for the same client.
With a single Gmail/Google Account (email address/password), you sign up as a Google Analytics user, and then create up to 100 different Google Analytics Accounts – that is, 100 groups of tracked websites.
About Google Analytics Properties
In Google Analytics, a Property is a single tracked website (or mobile phone app). Every Google Analytics Property belongs to a Google Analytics Account, and any one Google Analytics Account can contain up to 50 Google Analytics Properties.
In summary, you can create 100 different Google Analytics Accounts, each one of which can contain 50 Properties. That means, with a single Gmail/Google Account, Google Analytics will allow you to track 100 x 50 = 500 different websites.
When you look at the unique Tracking ID within each Google Analytics Tracking Code, you can see that it consists of two parts, separated by a hyphen (-). In the example of UA-122243940-1, the 122243940 part is the Account number, and the 1 at the end is the Property number. The letters UA stand for Universal Analytics.
About Google Analytics Views
Google Analytics allows you to create on-screen reports called Views that show selected information about traffic to a particular Property (tracked website). For any one Google Analytics Property, you can create up to 25 Views. An example of a View in Google Analytics would be one that displays web traffic only by female visitors from Australia, in the age range 25-34, who accessed a Property (tracked website) using Apple mobile devices.
Every time you create a new Property (that is, track a new website), Google Analytics automatically creates a ‘Show Me Everything’ View for that Property which it calls All Web Site Data.
If you look at your Google Analytics home screen, you can see near the top-left a dropdown list showing your currently selected Google Analytics Property and View. As you have created only one such Account/Property so far, it should look as shown below. Click the dropdown list to see your Google Account/Property/View structure in full.
Working with multiple Google Accounts and Properties
Over time, as you build more websites and need to track their visitors, you have two choices in how you manage those websites in Google Analytics:
- One Google Account/Many Google Properties: One approach would be to use the same Account to contain all the websites you track, with each new website added as a Property to that Account.
If you are building websites only for your employer or for one other organisation, this is the recommended way of organising Accounts and Properties.
- One Google Account/One Google Property: Another approach would be, that for every new website you want to track, you create one new Account and one new Property. With this approach, you would probably give the same name to both the Account and the Property.
If you are building websites for different clients, this is the recommended way of organising Accounts and Properties.
As a general rule, it’s probably best to follow the simpler One Account/One Property structure unless there is a very good reason to group several Properties within a single Account. The most common such reason for grouping multiple websites would be that they are all created for the same client organisation.
Using multiple Gmail/Google Accounts with Google Analytics
If you have more than one Gmail/Google Account, it may happen that, over time, you use different Gmail/Google Accounts to work with Google Analytics.
For example:
- You have two Gmail/Google Analytics Accounts: marysmith@gmail.com and msmith99@gmail.com.
- For some websites, you set up Google Analytics tracking with the first Gmail/Google Account. For other websites, you use your second Gmail/Google Account.
Now, you sign in to Google Analytics as follows:
- You go to https://www.google.com/analytics
- You then click the Sign in to Analytics button on the welcome screen.
- You sign in with your Gmail/Google Account of marysmith@gmail.com.
- However, in Google Analytics, you notice that you can see web traffic data only for some of your websites – but not others. Why are some tracked websites missing?
When you sign in to Google Analytics as marysmith@gmail.com, you will see only those websites for which you set up tracking as marysmith@gmail.com. The likely reason some websites are missing is that you used your other Gmail/Google Account (msmith99@gmail.com) to set up Google Analytics tracking for them.
Within Google Analytics, you can view all your Gmail/Google Accounts, and switch between different ones, by clicking the user icon at the top-right of any Google Analytics screen, and then selecting the relevant Gmail/Google Account.
Adding further websites to Google Analytics
After you have signed up to Google Analytics and added at least one website for tracking, here are the steps to track additional websites.
- Use your Gmail/Google Account to sign in to https://www.google.com/analytics.
- At the left of the Google Analytics home screen is a vertical menu of options. The last option is named Admin and has a gears icon beside it. Click this option.
- Your next step depends on whether you want to create a new Account to contain the new website you want to track. Or instead want to add that website to a Google Analytics Account that already exists:
- New Account: Typically, you will choose this option when you want to track a website for a new client. In the first (left) column, click the Create Account button.
- Existing Account: If the new website is for an existing client, and you have grouped together that client’s other websites within a Gooogle Account, you will typically choose this option.
In the second (centre) column, select the relevant Account from the dropdown list, and then click the Create Property button.
- Next, enter the details for the relevant website. If you have chosen to create a new Account, you will need to enter the Account Name. Complete the Terms of Service and, when finished, click the I Accept button.
You are now shown the Google Analytics Tracking Code with the unique Tracking ID for your website.
- Click anywhere within the Tracking Code area of the screen, and then paste the code into your web page or pages.
Sharing Google Analytics data with others
As a web designer/developer, you will often be the person who creates the Google Analytics Tracking Code for the websites you build. However, others will want to be able to view the web traffic information collected by Google Analytics. For example:
- Team colleagues in the marketing and IT departments of your organisation.
- External clients for whom you built websites.
Follow these steps to share Google Analytics data with one or more other people.
- Sign in to Google Analytics and, on your home screen, click the Admin menu option at the lower-left.
- On the next screen displayed you can see three columns of options: Account, Property and View. Each column contains an option with the same name: User Management.
- Account: By sharing a Google Analytics Account, you’re allowing another user access to traffic data for all Properties (tracked websites) within that Account. There may be up 50 different Properties within one Google Account.
Use the dropdown list at the top of the first column to select which Account you want to share.
- Property: This is a more limited sharing option. It grants the other person access to traffic data for just a single tracked website.
Use the dropdown lists at the top of the first and second columns to select which Account/Property you want to share.
- View: This is the most restricted option. The other person will only be able to access an on-screen report for the selected website.
Use the dropdown lists at the top of all three columns to select the Account/Property/View for sharing.
- On the next screen displayed, click the blue plus (+) icon at the top-right, and then select Add users.
- Enter the email address(es) of the people you want to share web traffic data with.
- Select the level of access you want to grant to others. This can include the ability for them to add further users.
- When finished, click the Add button at the top-right of the screen.
You can also use this User Management option on the Admin screen to remove Google Analytics sharing access from existing users or to vary their current access level.