Google Analytics Guide

Google Analytics (GA) was launched in 2005 and is a free web analytics tool that helps you analyze your web traffic.Although the idea of web traffic can seem like a small part of your business, it actually plays a significant role in your marketing strategy’s success. GA Google Analytics, for one, lets you complete the installation of Google Analytics with just your tracking ID. Save After installing and activating the plugin, go to ‘Google Analytics’ from the ‘Settings’ sub-menu.

You may have created a great website but, if you have no idea who your website visitors are, where they are coming from, which pages they are visiting, how long they are staying on your site, and why and when they are leaving your site, you could be wasting a lot of money and effort on targeting the wrong type of audience. The same thing applies if you make a blog, you will need to know which posts are going to be your most popular ones and how many blog visitors you will convert. You need to know the answers to these and many other important questions in order to be able to optimize your website or blog and actually make it effective.

This is exactly where Google Analytics can be of immense help, as it can give you a clear insight into your website traffic so that you can know how to improve the performance of your site and ensure your conversion rates keep going up.

Why Do You Need Google Analytics?

Google Analytics is a completely free web analytics tool provided by Google that helps you measure your website traffic and gather vital information about your website visitors. This tool can give you the answers to all of the aforementioned questions and, thus, enable you to see how your website is actually performing.

When you know what works and what doesn’t work, you will know exactly what steps you need to take in order to optimize your website and every piece of content you provide on it with the goal of engaging your visitors and providing them with the information they need.

Since Google Analytics gives you a clear picture of what changes you need to implement to improve your site and maximize your conversions, it goes without saying that your next step towards your site’s improvement should definitely be using this tool.

It is completely free of charge and, given the information it can provide you with, you can be sure that it will help you make your every online marketing campaign result in actual benefits that will lead to the improvement of your bottom line.

When you access Google Analytics as a complete beginner, everything may seem overwhelming at first, but this guide will walk you through it and, by the end of it, you will certainly get the hang of how to use this extremely useful tool to maximize your site’s performance.

How to Set up Your Google Analytics Account

Before you get started with Google Analytics, you need to create a Google account. Only with a Google account can you actually have access to Google Analytics, so you can either create a new one or use the one you already have, but make sure that only you have access to it.

Once you have created your Google account, you can go to Google Analytics to set up your new account.

Click on the Analytics tab and you will be sent to a new page, where you will need to click on the green Sign up for free button.

When you click on the green button, you will be provided with the three steps you need to take in order to set up your Google Analytics account. The page you will arrive at will look like this:

Click on the Sign up button and you will be asked to fill out the necessary information for your new account.

Step 1: Sign up for Google Analytics

Here you need to enter your new account information for your website in the appropriate boxes.

After you enter the necessary information, you will need to configure your data sharing settings, the options for which will be right below.

After this step, simply click on the blue Get Tracking ID button and the next thing you need to do is agree to the Google Analytics terms and conditions, for which you will get a pop up window after clicking on the button.

Step 2: Add tracking code to any website

Once you agree to the terms and conditions, you will arrive at the next page where you will need to click on the Admin tag in order to get to your tracking code. On the Admin tab, you need to go to the ACCOUNT column and choose your account from the drop-down menu. After that, go to the PROPERTY column, choose a property from the drop-down menu and go to Tracking Info > Tracking Code.

Your tracking code needs to be installed on every page on your website that you want to track in order for Google Analytics to be able to measure and report the activity on your website. The installation of the code depends on the type of website you have and what CMS platform you are using.

For instance, if you have a WordPress website, you can use MonsterInsights, which is the best Google Analytics plugin for WordPress and it will enable you to easily install your tracking code on any page that you want.

On the other hand, if your website is built with HTML files, you can add your tracking code to the source code of your every website page with the use of an online HTML Editor or a text editor program, such as Notepad (Windows) or TextEdit (Mac). You can install your tracking code by adding it before the </head> tag on every page you want to track.

After you have edited the code in the text editor program, you need to upload the coded files to your site’s pages with the use of an FTP (File Transfer Protocol) program, such as SmartFTP or FileZilla, for instance. However, you need to know basic HTML in order to be able to use FTP.

Step 3: Add tracking code to a WordPress website

Google Analytics code can be installed to your WordPress site by following one of the next two methods.

Method 1: Adding the Google Analytics Code Manually

Following the next steps requires basic knowledge of WordPress and how it uses templates in order to manage content.

Step 1

Once you have copied the tracking code supplied by Google Analytics, you will need to log into your website, through wp-admin, in order to access the Dashboard.

Mouse over the Appearance tab in the left menu bar and select Editor, just like in picture below.

Step 2

Once you have opened the Edit Themes page, you will have to take a look at the Templates section of the page which is located on the right side of the screen. You are looking for a file named “header.php”. In order to speed things up, you can press “CTRL + F” and search for this file name. Check the picture below. When you find it, click on it.

Step 3

After you click on “header.php”, the Theme Editor will open it and allow you to edit it. You need to look for the html tag </head>. In order to quickly find it press “CTRL + F” and search for “</head>”, just like in the picture below.

Click in front of this tag, press Enter, and paste the Tracking Code right above it.

Step 4

After you have pasted the code, click on the “Update File” button, located just below the file editing area.

Step 5

In order to check that you have done things right, you have to go back to the Tab where you have Google Analytics opened. Give it a couple of minutes and then refresh it to see if your Google Analytic account is receiving data. If there is no data, you can force the test by clicking on the “Send test traffic” button.

In order to see the reports of actual traffic data, you should try accessing the Reporting tab in Google Analytics once after 12-24 hours have passed, after you have updated your “header.php” file.

Method 2: Google Analytic WordPress Plugin – The Google Analytics for WordPress by MonsterInsights Plugin

You can add Google Analytics to your website by installing and setting up the Google Analytics for WordPress by MonsterInsights plugin. This plugin is very easy to configure, and it will allow you to start tracking website traffic immediately after configuring it.

Step 1

Mouse over the Plugins option in the left menu bar and click on Add New.

Step 2

In the Search bar, located in the upper right corner, type in Google Analytics for WordPress by Monsterinsight. Click on the Install Now button and then on Activate, just like in the picture below.

Step 3

Now you have to configure the plugin you have just installed and activated. To do so, you have to access the settings by mousing over Insights on the left bar and clicking on Settings. Check the picture below.

This will open the plugin settings page.

Google Analytics Guide Moz

Step 4

Now, you need to connect your Google Analytics account to the plugin. You can do this by automatically authenticating it with your Google account or by manually entering the US (User account code).

Automatic Authentication. Sign in to your Google Analytics and click on the “Authenticate with your google account”. You will have to go through the setup procedure in order to connect your Google Analytic account with the plugin. We recommend this method since manually entering the UA code will prevent you from using the dashboard and the reports features of the plugin.

Enter the UA code manually. Click on the “Click here to authenticate manually.” Link on the plugin settings page.

You will have to go to your Google Analytics account, and look for Tracking Code under Property > Tracking Info. Copy the entire code, including UA, located under the Tracking ID tag. Check the picture below.

Go back to the tab where you have the plugin settings opened, paste the code and click on the “Save Changes” button. Give it 12-24 hours before you check the website traffic data.

If you have used automatic Authentication, you will be able to access the MonsterInsights Dashboard through your wp-admin panel and view all the data the plugin automatically pulls from your Google Analytics account. On the other hand, if you have manually entered the tracking ID, you will need to review the data by logging into your Google Analytics account.

Step 4: Learn about your audience

When you arrive at this step, you will be able to track the data you want, but it will take a few hours for your account to be up and running (it can take up to 24 hours). In the meantime, there are several more bits and pieces you need to tackle and, of course, you need to learn how to actually use Google Analytics in order to be able to understand the information it provides you with, so read on to delve deeper into the matter.

Set up Site Search

Setting up site search will help you know what your visitors are looking for when they are checking out your website. First, you need to sign in to your Google Analytics account and go to the Admin tab, where you will see three columns: ACCOUNT, PROPERTY and VIEW. Go to the VIEW column and click on the View Settings.

Here you will see Site Search Settings, where you will need to set Site search Tracking to ON.

After that, you will be provided with the Query Parameter box, where you will need to enter your site’s search query parameter.

The query parameter is usually “s” or “q”, but you can check yours by running a search on your website. No matter what you search for in your site’s search box, you will see your query parameter in your URL placed right before your query. For instance, if you search for the word “mobile” on Google, the URL for your search result will look like this:

Therefore, your query parameter will be “q” (right before “=mobile”).

After that, just click on the Save button and Google Analytics will be able to track every single search made on your website.

Set up Your Goals

You will need to set up your goals in order for Google Analytics to track important activity on your website. For instance, if you have an e-commerce website, you should have a confirmation page for your customers on which they will land after they have completed a purchase. Or, if you use a contact information form to generate your leads, you should create a “Thank You” page for your website visitors to land upon after they have subscribed to your email list, for instance.

Why is this important? Because when you set up certain goals, Google Analytics will be able to track your conversions and provide you with crucial information that will help you determine the effectiveness of your website.

When you configure certain actions as goals and your website visitors take those actions, Google Analytics will record that as a conversion and you will be able to get a clear picture of your every effort. With all the information you will receive, you will know exactly what does and what doesn’t bear fruit so that you can implement changes where necessary and keep improving your website.

You can create up to 20 goals and, whenever a specified activity is triggered, Google Analytics will measure it and provide you with a detailed report.

Without further ado, here are the detailed steps for setting up your goals.

Click on the Admin tab in Google Analytics and go to the VIEW column, where you need to click on Goals.

Next, click on the red button that reads + NEW GOAL.

After that, you will be provided with three steps that you need to take before you can create your goal.

Step 1: Goal Setup

This first step includes three options for setting up your goals, and those are using a template, creating custom goals, or creating Smart Goals.

The option you will choose depends on the type of website you have and on your business objectives, as you will come to understand soon enough, so read on.

Option 1: Template

Under Template, you will find four goal categories: REVENUE, ACQUISITION, INQUIRY and ENGAGEMENT. Goal templates can help you set up goals that will be aligned with your business objectives. You can create a goal for each of the categories, because it will help you learn a lot more about how your website visitors are interacting with the content you provide them with.

Option 2: Custom

If the aforementioned categories are not important for your website tracking (and if the third option of Smart Goals is either not important to you or not applicable), you should choose the Custom option, after which you simply need to click on the Next step button.

Option 3: Smart Goals

Smart Goals can help AdWords advertisers use the AdWords optimization tools in order to track and increase their conversions. When you choose the option of Smart Goals, Google Analytics will give each of your website visits a score, which will help you determine which visits are most likely to lead to a conversion. Therefore, it will translate those visits into Smart Goals.

If this option is applicable to you website and you want to choose it, all you need to do is give your Smart Goal a name and proceed to the next step.

Step 2: Goal description

This step requires that you name your goal and choose its type. There are four types available: Destination, Duration, Pages/Screens per session and Event.

You need to name each and every one of your goals as something intuitive so that you can clearly understand every piece of information in Google Analytics reports. Because you can later change your existing goals (you can never delete them!), you need to make sure their names are intuitive and you remember the exact point at which you repurposed them (because there is no historical data), so that you don’t get confused when inspecting your reports.

Type 1: Destination

If your goal is to measure the success of your subscriptions, for instance, and you want to treat pageviews as your conversions, choose Destination as your goal type and click on the Next step button.

Type 2: Duration

Choose Duration as your goal type if you want to treat time on your particular pages as conversions in order to track the engagement of your website visitors.

Type 3: Pages/Screens per session

If you want to treat the number of pages per session as a conversion, then choose Pages/Screens per session as your goal type and proceed to the next step.

Note: The term “screens” here refers to mobile app screens when you want to use Google Analytics to measure the performance of a mobile app, so don’t be confused by it.

Type 4: Events

Choose Event as your goal type if you want to treat the interactions of your visitors with your website as conversions. For instance, if you want them to watch a video after they have reached the penultimate step towards a conversion, create an event goal that you can measure. You can specify the details of your event goal in the next step so, after you have chosen the Event type, simply click on the Next Step button.

Step 3: Goal details

If you have chosen Destination as your goal type, you need to enter the page URL or screen name in the specified field. For instance, if you want the measured activity to end with a “Thank You” page, enter “/thank-you” or “/thank-you.html” and select the desired match type from the drop-down menu.

There are three match types: “Equals to”, “Begins with” and “Regular expression”.

You can then assign a monetary value to your conversions, which is completely optional. It can help you compare your conversions, and track and measure any changes made on your website.

Note: If you have chosen Smart Goals, you cannot assign a monetary value during the goal setup.

You can also choose to specify a funnel for your goal, which shows the path that your website visitors will take in order to reach your specified destination. If you choose to create a funnel, you need to enter a page name for each step included, just as in the Destination field.

If you have chosen Duration as your goal type, you need to specify the minimum amount of time on particular pages that you want to track that will indicate your goal conversions. You will be provided with three fields: Hours, Minutes and Seconds. When your website visitors spend more than your specified time on your website, it means you will generate a conversion.

If your chosen goal type is Pages/Screens per session, you need to specify the number of pages that will indicate a conversion. This means that you will generate a conversion every time a website visitor views more pages than you have specified.

If you have chosen an Event goal type, you will be provided with the Event conditions, so that you can configure the components of your every event (you need to create at least one event in order to measure your Event goal).

After you have completed all of the aforementioned steps, simply click on the blue Create Goal button and you are good to go.

Note: You have a 100 accounts limit on Google Analytics so, if you want to create a new one, all you have to do is go to the Admin tab, click on the drop-down menu under the ACCOUNT column and then select the Create new account option.

You can also create a new property, that is, add another website under your existing account. You can add up to 50 websites to your account and you can easily do so on the Admin tab and under the PROPERTY column, where you can select the Create new property option from the drop-down menu. After that, all you need to do is follow the aforementioned steps again in order to be able to use Google Analytics for your new website.

How to Use Google Analytics

Once you have your Google Analytics account up and running, you will start getting a lot of different reports that will help you know which areas of your website need improvement. To an absolute beginner, those reports and pie charts may seem a bit confusing, which is exactly why the rest of this guide will be of immense help.

By the end of it, you will understand the information your reports will provide you with, as well as what some key metrics are, and you will be able to easily find your way around your Google Analytics dashboard.

There are four main tabs in your Google Analytics account: Home, Reporting, Customization, and Admin tab. Take a look at what you will find under each of them so that you can better understand your data.

1) Home Tab

On your Home tab, you will be able to take a look at the quick overview of your account. If you have more than one website under your account, you will be shown a list of all of them, so that you can easily choose the one for which you want to see the reports on your website traffic.

On this tab, you will also be provided with important data regarding your sessions, average session duration, bounce rate and goal conversion rate for each and every one of the websites you may have. Here is a quick overview of what each of those actually mean, as they will be discussed in detail later.

Sessions – The Sessions column shows the sum of all the interactions on your website that occurred within a particular timeframe.

Avg. Session Duration – The Average Session Duration column shows the average duration of all the sessions that took place on your website within a particular timeframe.

Bounce Rate – The Bounce Rate column shows the percentage of users who have left your website at some point, that is, who have “bounced” from your website.

Goal Conversion Rate – The Goal Conversion Rate column shows the sum of the overall conversion rate on your website.

2) Reporting Tab

If you have one website under your account, Google Analytics will take you straight to the Audience Overview report under the Reporting tab every time you log into your account. If you have more than one website, it will take you to the PROPERTY column under the Admin tab, so that you can choose the website for which you want to see the reports, after which you will be taken to your Audience Overview report.

Nevertheless, the Reporting tab in Google Analytics provides you with dashboards and important reports that can give you an insight into how your website is actually performing, so that you can know where and how to make improvements.

Dashboards

When you click on Dashboards, you can see an overview of your most important reports. You can create and customize your dashboards very easily, and you can add as many widgets as you want. You can keep track of anything that is of importance to your website, such as the success of your social media campaigns, the performance of your content and much more.

Shortcuts

Shortcuts will give quick access to the reports that you use the most. It may come in pretty handy, not only because it saves time, but also because it saves any change you make. For instance, if you add a new metric to a particular report, that setting will stay applied in Shortcuts until you decide to change it. Even when you sign out from your account, the settings applied in Shortcuts will not change.

However, the date range will not be saved in Shortcuts, so make sure you check the dates every time you use your shortcuts so that you can be sure you are viewing the right reports you need.

Intelligence Events

Intelligence Events will show you an overview regarding any statistical variations in your website traffic. When a variation occurs, Google Analytics will send you an alert to let you know. When you click on Overview under Intelligence Events, you will be provided with two tabs: Automatic Alerts and Custom Alerts.

On the Automatic Alerts tab, you will see the changes that Google Analytics detected in the statistics of your website traffic. On the Custom Alerts tab, you will receive alerts when your website traffic reaches a certain threshold that you have previously specified. Apart from the Intelligence Events Overview, you can take a look at your daily, weekly and monthly events.

Real-Time Reports

Real-Time reports provide you with useful information about the website visitors who are currently on your website. Therefore, as the name suggests, you get reports in real-time. In the Real-Time Overview, you can see the exact number of active users on your website, how many of your website pages are being viewed per minute and per second, the top keywords your active users are using, and a list of your top active pages, along with the number of active users per each of those pages.

Apart from the Overview, you can check the other tabs in Real-Time: Location, Traffic Sources, Content, Events and Conversions in order to take a look at the corresponding data regarding your active users.

Audience Reports

The Audience reports, as the name suggests, provide you with information about your website visitors. In the Audience Overview tab, you can see how many sessions there are on your website over a particular time period. You can choose to see the hourly, daily, weekly and monthly reports.

Under the graph showing you the number of your sessions for a particular time period, you will be provided with additional information about your audience, including the number of users, the number of pageviews, the number of pages per session, average session duration, bounce rate, and the percentage of new sessions. Also, you will get a pie chart showing you the ratio of new visitors to returning visitors.

Under all of those metrics, you can see where your website visitors are coming from (country, city) and what language they are speaking, as well as what browsers, service providers and operating systems they are using when visiting your website.

In the top right corner of the Audience Overview tab, you can change the date range to choose a time period for which you want to view the reports. You can also check the Compare to box and compare the reports from one date range to some of the previous ones.

When it comes to the graph showing you the overview of all of your sessions for a particular timeframe, you can hover the graph line in order to see the number of sessions for a particular day.

Apart from the Overview tab in Audience reports, you will find a number of other tabs that will provide you with additional information about your website visitors. Those tabs include: Demographics, Interests, Geo, Behavior, Technology, Mobile, Custom, Benchmarking and Users Flow.

The Demographics tab shows you the age and gender of your website visitors. The Interests tab shows you what the interests of your website visitors are, including areas such as technology, movies, travel, news and much more. The Geo tab shows you the locations of your audience and the languages they speak. The Behavior tab shows the behavior of your audience, that is, their interaction with your website (their engagement on your website, whether they are first-time or returning visitors, how often they visit your site).

The Technology and Mobile tabs show you what platform your audience is using when visiting your website (browsers, operating systems, networks, devices). You can use the Custom tab to add custom variables that will help you learn more about your audience over a particular date range.

The Benchmarking tab allows you to compare your date with that of your competition so that you can gain insight into industry trends and target your audience better. However, you can use benchmarking to compare data only with companies that actually share their data. If you use benchmarking, you can choose from three different reports: Channels, Location and Devices.

The Users Flow tab provides you with a graph that shows your audience’s journey through your site, that is, on which page they landed, which pages they viewed and at what point they left your site.

Acquisition Reports

The Acquisition reports will show you how your website visitors actually came to your site. It will provide you with an overview of your direct, organic, referral and social (coming from social media) traffic, as well as traffic coming from email. If you use AdWords, you can see how your PPC campaigns are performing. All you need to do is go to the Admin tab and link your AdWords account to your Google Analytics account.

The Search Engine Optimization tab in the Acquisition reports shows you which keywords your website visitors searched for to come to your website. However, in order to use this tab, you need to have a Google Webmaster account and link it to your Google Analytics account.

Behavior Reports

The Behavior reports will show you how your website visitors are interacting with your website so that you can know how your content is actually performing. You can view important reports in the following tabs: Behavior Flow, showing you the pages your visitors are navigating, from the landing to the exit page, Experiments, allowing you to conduct A/B testing to see which of your landing pages are performing best, so that you can optimize your conversion goals and In-Page Analytics, allowing you to view your web pages along with your Google Analytics data. In order to use In-Page Analytics reports, you need to install the Page Analytics extension for Google Chrome, so that you can have access to real-time data.

In the Behavior Flow reports, you will find additional reports that can be of great use, including Site Content, Site Speed, Site Search, Events and Publisher reports. The Site Content reports show the content on your site that is performing best, that is, your top pages, your top landing pages, and top exit pages. The Site Speed reports show you how fast your website actually is, along with the pages that may be slowing it down, and it provides you with suggestions on how to speed up your website.

The Site Search reports show you the keywords your website visitors are using on your site, but you need to set up site search in order to be able to view those reports. The Events reports let you track the specific actions of your website visitors, such as downloading your eBook, for instance, or clicking on a particular link. In order to use the Publisher reports, you need to have an AdSense account and link it to your Google Analytics account. If you do that, you can view your AdSense publisher data in the Publisher reports.

Conversions Reports

The Conversions reports will show you the actions your website visitors have taken before they actually converted. These reports will show you their entire path towards conversion, as well as how many conversions have taken place on your website.

You have four different reports in the Conversions tab: Goals, Ecommerce, Multi-Channel Funnels and Attribution. The Goals reports allow you to create and track your conversions, that is, create and track goals that lead to conversions. The Ecommerce reports will give you an insight into the activity of your customers (if you have an ecommerce store on your website, of course).

The Multi-Channel Funnels reports will show you how your marketing channels are performing in order to lead to conversions. The Attribution reports let you assign credit for conversions to specific points on the conversion journey.

Customization Tab

The Customization tab lets you create and track custom reports according to your particular needs. You can create as many custom reports as you want, and you can always access them in the Customization tab.

In order to create a custom report, you need to choose a metric you want to track and at least one dimension. For instance, you can choose to track pageviews and bounce rates (metrics) and country and operating systems (dimensions).

Admin Tab

The Admin tab in your Google Analytics account is where you can manage your account and switch to different accounts, if you happen to have more than one. As you already know, it is also where you can choose for which of your websites (if you have more than one) you want to view the needed reports. In this tab, you also set you goals and you can link your AdWords and AdSense accounts, for instance, and measure the performance of your campaigns. Apart from account and property settings and management, you can also create user segments, set up alerts, specify attribution models and set up scheduled emails.

3) Google Analytics Metrics

Some of the following metrics have briefly been mentioned above, but here is a list of the key ones that you need to understand in order to be able to understand your Google Analytics reports.

Sessions – The Sessions metric shows you the number of interactions on your website over a particular time period. One session can include many pageviews and events, as well as e-commerce transactions. The duration of one session is 30 minutes by default so, if a website visitor engaged in a session on your website and returned after a minimum of 30 minutes of inactivity, your report will show it as a new session.

Users – The Users metric shows you the number of users who visited your website within a particular timeframe.

Pageviews – The Pageviews metric shows you the number of views of your web pages, but it includes only those that Google Analytics is actually tracking. The reloading of a page, as well as returning to a particular page after navigating through your site, counts as an additional pageview.

Pages / Session – The Pages / Session metric shows you the average number of visited pages per one session. For instance, if one website visitor visits five pages in a single session and another one visits four pages in one session, the Pages / Session metric will show 4.5 (5+4 / 2 = 4.5).

Avg. Session Duration – Average Session Duration is not a metric that can provide you with a precise answer regarding the average time your visitors spend on your website. This is due to the fact that this metric is calculated by subtracting the duration of the last engagement on your website with the duration of the first engagement, without measuring the time duration on exit pages. For instance, if a visitor lands on a particular page on your website and stays there for 5 minutes before leaving it, the session duration would be 0 seconds. Therefore, this metric only indicates the average session duration, rather than giving you the exact data.

Bounce Rate – The Bounce Rate metric shows you the percentage of website visitors who bounced back from your website. That means that they left your site immediately after landing on one of its pages, without navigating any further.

% New Sessions – This metric shows you the percentage of new sessions that have taken place on your website, that is, the percentage of sessions from new visitors.

Goal Conversion Rate – Google Analytics measures the conversion rate of each and every one of your goals and then shows you the sum of their conversion rates. For instance, if you have five goals that you have set up for your website and each of them has a 20% conversion rate, Google Analytics will show you that the goal conversion rate for your website is 100%. However, since it shows you the sum of all of your goals, it means that you still need to make a lot of effort to make sure that your website performs better.

Conclusion

Google Analytics is an excellent tool for measuring your website traffic, as it can provide you with the right information for improving your website and maximizing its performance. When you manage to do that, you will achieve your goals quickly and you will make sure that your every effort leads to positive results.

Hopefully, this guide has provided you with all the necessary answers for accomplishing that, so go and create your Google Analytics account right now and take a huge step towards making your website as effective as possible.

There are several versions of SharePoint, but we can break them up into two categories. On-premises, which consist of SharePoint 2007,2010,2013,2016 and 2019, and then SharePoint Online, which is part of Office 365.

In order to deploy Google Analytics to a SharePoint site, you will need to know which type of SharePoint you are deploying to first.

How to setup Google Analytics

In order to gather analytics, you will need to signup to Google Analytics (GA) and identify your SharePoint site with a tracking code.

  1. Go to https://analytics.google.com and signup or sign in.
  2. On the dashboard find the Admin cog at the bottom left and click it.
  3. Under the Admin Tab, find ‘Account’ and click ‘+ Create Account’.
  4. Fill in the following information required and uncheck all the boxes, unless you really do want to share your corporate information with Google.

Account Name, Website Name, Website URL, Industry Category, Reporting Time Zone

And then click Get Tracking ID.

  1. You will be prompted to accept Google Analytics Terms of Service Agreement based on your region.

Notes

  • Subject to Section 15, the Service is provided without charge to You for up to 10 million Hits per month per account. Any outstanding balance becomes immediately due and payable upon termination of this Agreement and any collection expenses (including legal fees) incurred by Google will be included in the amount owed, and may be charged to the credit card or other billing mechanism associated with Your AdWords account.
  • You will not and will not assist or permit any third party to, pass information to Google that Google could use or recognize as personally identifiable information. You will have and abide by an appropriate Privacy Policy and will comply with all applicable laws, policies, and regulations relating to the collection of information from Visitors. You must post a Privacy Policy and that Privacy Policy must provide notice of Your use of cookies that are used to collect data. You must disclose the use of Google Analytics, and how it collects and processes data.
  • To the extent permitted by applicable law, You will indemnify, hold harmless and defend Google and its wholly owned subsidiaries, at Your expense, from any and all third-party claims, actions, proceedings and suits brought against Google or any of its officers, directors, employees, agents or affiliates, and all related liabilities, damages, settlements, penalties, fines, costs or expenses (including, reasonable lawyers’ fees and other litigation expenses) incurred by Google or any of its officers, directors, employees, agents or affiliates, arising out of or relating to (i) Your breach of any term or condition of this Agreement, (ii) Your use of the Service, (iii) Your violations of applicable laws, rules or regulations in connection with the Service, (iv) any representations and warranties made by You concerning any aspect of the Service, the Software or Reports to any Third Party; (v) any claims made by or on behalf of any Third Party pertaining directly or indirectly to Your use of the Service, the Software or Reports; (vi) violations of Your obligations of privacy to any Third Party; and (vii) any claims with respect to acts or omissions of any Third Party in connection with the Service, the Software or Reports.
  • If You use the Service on behalf of the Third Party or a Third Party otherwise uses the Service through Your Account, whether or not You are authorized by Google to do so, then You represent and warrant that (a) You are authorised to act on behalf of, and bind to this Agreement, the Third Party to all obligations that You have under this Agreement, (b) Google may share with the Third Party any Customer Data that is specific to the Third Party’s Properties, and (c) You will not disclose Third Party’s Customer Data to any other party without the Third Party’s consent.

If you agree to the above and the other parts not shown here in the agreement click ‘I accept’ to continue. If you do not agree, click ‘I Do Not Accept’ and find an alternative solution.

  1. Copy your tracking code for the next step, deploying to SharePoint

How to deploy Google Analytics

To deploy your Google Analytics (GA) to SharePoint, you will need to find out what version of SharePoint you are in fact running. This is pretty straight forward follow this guide “Which version of SharePoint am I using” and if you still unsure check out the HTTP Response header for MicrosoftSharePointTeamServices and compare it to this guide.

Browse to your SharePoint site, push F12 in the browser to bring up the development console and search for ‘MicrosoftSharePointTeamServices’.

The following versions numbers are related to the version of SharePoint available.

12.0+

SharePoint 2007

14.0+

SharePoint 2010

15.0+

SharePoint 2013

16.0.4+

SharePoint 2016

16.0.1-16.0.2

SharePoint 2019

16.0.0.8+

SharePoint Online

SharePoint 2010/2013

For SharePoint 2010 and 2013 you either need a WSP or Farm Solution and depending on who you are in the business a Site Collection Admin or a Farm Administrator you would require either or, let me show you both.

*You can also use this method to create solutions for 2016/2019 but leveraging the SharePoint Framework is preferred and explained below.

  1. Fire up Visual Studio and find SharePoint 2013– Empty Project

I am going to create a SharePoint 2013 Empty project and call it ‘GoogleAnalyticsforSharePoint’.

Lets select a farm solution as they are easy to deploy and manage as long as you are a farm administrator.

Once the project has been created add a New Item.

Select Empty Element and call it Custom Action

And another New Item and this time select Module and call it Style Library

Once created feel free to delete ‘Sample.txt’ from the Style Library Module.

Now create a folder structure within Style Library GA->js

Then add a Javascript File to GA>JS file structure

This is what your final file structure should look like

Now update the Feature information to have a proper Title and Description

Now add the following code to your ga.js file and ensure to change ‘Tracking ID’ with the actually tracking ID given to you from the Google Analytics site.

Now simply Run the application and test.

Under Site Settings > Site Features, you will notice our feature.

Check your Real-time analytics on the Google

Online

For SharePoint Online/2016/2019, you will need to create the application customizer extension project which is provided by the SharePoint Framework. You are no longer allowed to add code via WSP or sandboxed solutions and I strongly encourage you not to inject this code into the master page or JavaScript web part. It just becomes more difficult to manage and does not capture all visitors which skews the numbers and therefore pointless.

The below guide shows an Online deployment but can be used in the very same way for 2016/2019 deployments.

  1. Run the following from CMD

Yo @microsoft/sharepoint

Once successfully deployed you should see this.

  1. Open the project in Visual Studio by selecting Open > Folder … > Location of the saved project above in step 1.
  2. Locate src/extensions/gaForSharePoint/GaForSharePointApplicationCustomizer.ts.
  3. Find the export interface and remove the sample code and notes from this

To this

// Google Analytics Tracking ID

trackingID: string;

}

  1. In the same file ‘GaForSharePointApplicationCustomizer.ts locate
  1. Then from CMD prompt in the Google Analytics for SharePoint package folder run the following command

gulp bundle –ship

  1. Now build the solution with the following command;

You will be able to find the package under sharepointsolution with the file extension *.sppkg

  1. Extensions won’t be automatically enabled. SharePoint Framework extensions must be specifically associated to sites, lists, and fields programmatically to be visible to site users.

To achieve the steps described in this section you will need to install the SharePoint PnP PowerShell.

In PowerShell as admin simply run the following command;

We will need this later.

  1. Log onto SharePoint Office 365 as Admin > Go to SharePoint Admin.

Select Apps > App Catalog.

In App Catalog select ‘Distribute apps for SharePoint’.

Click ‘New’ and select the package location from step 7.

Make sure the solution is available to all sites in the organization and click ‘Deploy’.

  1. Now we are at the final stretch, we simply need to connect to Office 365 and enable the extension with the PowerShell commands we installed earlier.

Run the following command to connect to your Office 365 tenant, changing the URL to your own.

  1. Now we enable the extensions by running the following command remembering to change the UA Tracking ID to the one you received from Google when creating the Analytics Account along with the ID Guid from your project found in manifest.json.

If you do receive any errors about Access denied, make sure the user you have logged in with has Owner rights on the site you are deploying too.

  1. Check to ensure your code is working head over to the Google Analytics.

Cons of using Google Analytics

  1. Google strictly prohibit the capturing of Person Identifiable Information (PPI) which you accept when signing up for GA. This means that even if you figure out a way to add the account names to monitoring you are in violation of their policy and they can remove your data at any time and ban you from using the service.
Google analytics guidelines

Google Analytics Guide Pdf

This then means that understanding user trends pulling specific reports on teams and management is not possible.

  1. The service is only free up to 10 million hit per month and then billing will occur via Adwords account.
  2. Data Security – I personally think some of the URL’s found are used in the search engine crawlers, if you simply google your private URL after adding google analytics to it, you may find the URL there with multiple sub sites leaking directory structure. The only way this is possible is if the site map is being created by analytics and shared with Google crawlers.
  3. Document usage analytics is not available in GA as it does not track document usage or file downloads, only page hits.
  4. Site specific group permissions are not available in GA, so everyone who has access to GA has access to the results.
  5. GA was not designed for SharePoint and intranets, it was designed for public facing sites to allow website owners to better their sites, generate more traffic and there for sell more ads for Google.

If you are serious about SharePoint specific analytics and how to improve your intranet and user adoption get a tool that was developed and designed with exactly that in mind SharePoint Vitals

References

https://stackoverflow.com/questions/48882321/google-analytics-and-sharepoint-online

https://sharepoint.stackexchange.com/questions/210372/how-do-i-add-google-analytics-into-sharepoint-2013-on-line

https://www.youtube.com/watch?v=K9SpAVdo7I8

http://www.sharepointdiary.com/2014/05/how-to-integrate-google-analytics-with-sharepoint.html

https://www.tatvasoft.com.au/blog/event-tracking-in-google-analytics-with-sharepoint-online/

https://support.shortpoint.com/support/solutions/articles/1000265440-how-to-track-your-sharepoint-site-usage-with-google-analytics

https://fiechter.eu/2014/02/24/google-analytics-for-sharepoint-2013-office-365/Version 1 6 perfect storm full.

https://social.technet.microsoft.com/Forums/en-US/1e0b548a-3235-4b13-bf80-ffef2e681991/applying-google-analytics-code-on-sharepoint-online-sites-o365?forum=CloudSSA

https://blog.mastykarz.nl/tracking-links-google-analytics-sharepoint-2010-mavention-google-analytics-links-tracking/

https://gist.github.com/vgrem/2884bdad94d450e0f869

https://joelfmrodrigues.wordpress.com/2019/01/10/add-google-analytics-to-sharepoint-modern-pages/

http://www.allthingssharepoint.nl/add-google-analytics-sharepoint-sharepoint-2013-sharepoint-online-office-365/

https://blog.intlock.com/analyzing-visitor-paths-using-google-analytics/

Google Analytics User Guide

https://zimmergren.net/integrating-the-google-analytics-api-in-sharepoint-in-order-to-enable-users-to-review-analytics-data-directly/

Google Analytics Developer Guide

https://allcloud.com/blog/optimizing-google-analytics-for-sharepoint-and-office-365/

Google Analytics Guide 2020

https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/33823753-google-analytics-for-communication-sites