How to add Google Analytics to your Website

This is a short tutorial on how to get a Google Analytics tracking ID and tracking code for your website and how to subsequently add Google Analytics to your WordPress website, Shopify online shop or any other website.

Google Analytics is a great way to keep track of your visitor statistics and optimize your site. To get started, go to the Google Analytics page and either create a new account or log into your existing one.

Creating a new Website in Google Analytics

Google Analytics 01

To add a new website or “Property” as Google calls it, make sure you’re logged into your Analytics account, then go to “Admin”. If you have multiple accounts, make sure you have picked the correct one on the left. Then in the middle column (I’ve hidden the right one in the screenshot above) open the drop-down menu under “Property” and click “Create new property”. This will then lead you to the next step.

Before we get there, some more things what you will see on the screen later on, once you’ve created a new property. There will be a list of websites you have added to Google Analytics where the top orange rectangle is. Furthermore, Google lets you know how many free properties you already use and how many you still have left. Most users can use Google Analytics for free, however, there are limits in terms of number of websites/properties (currently 50) as well as number of visitors. For more information on that, check out the information on your account directly.

Google Analytics 02

So, let’s get back to the process of adding the website to your account. After clicking “Create new property” you get to a page which kind of looks like the screenshot above (after you scroll down a bit). On the top of the page you can choose between website and app, website should be chosen by default, if not, click on the area to pick this option.

Next, under “Setting up your property”, enter all the information required. The website name is mainly a name for your own reference which you will later on see in the list overview in the Reporting section. For Website URL simply choose the root URL of your website and pick either http if you don’t have a SSL certificate or https if you do. If in doubt about what to pick there, simply take a look at the URL in your browser when you go to the main page of your website. Then simply copy the URL to Google Analytics and make sure everything is the same (or ask your web developer if available).

Under “Industry Category” pick the industry that best fits your site. Then go on and pick your time zone and finish the process by clicking on “Get Tracking ID”. After that, if everything goes ok, you might have to wait a couple of seconds to be redirected to the final page containing the tracking ID and the tracking javascript code.

The Google Analytics Tracking ID & Javascript Code

Google Analytics 03

On the final page you now have two sections that are important. Number one is the top one called “Tracking ID”. There you can find your universal analytics ID number starting with UA- followed by a combination of numbers.

Below that in the “Website tracking” section and also marked red in the screenshot above you can find the tracking code. This is some Javascript code which needs to be inserted into your website to enable Google Analytics to track everything that’s going on on your site.

If you work with a web developer or an agency, you can now send them either the code snippet or the ID, whatever they want you to send them. If you work with us (Wohok Solutions), please simply send us the Tracking ID, we will then take care of the rest.

If you’ve created your website yourself or if you’re using a third party platform, here a couple of ways to add either the ID or the code snippet to your website.

Connecting your Website with Google Analytics

Now that you have added your site to Google Analytics, it’s time to connect your website to your account using the tracking ID and/or the tracking code. Depending on what platform or content management system you’re using, adding the code or the ID to your website will vary slightly. Here a couple of ways for systems we work with on a regular basis:

Adding Google Analytics using WordPress and All in One SEO

All in One SEO is a great plugin we at Wohok Solutions use for all of our WordPress websites. If you have this plugin installed, simply log into your WordPress backend, go to “All in One SEO” in the left top corner, then scroll down to the middle of the “General Settings” page where you will find a text field labelled “Google Analytics ID”. Simply add your Tracking ID (UA-xxxxxxxx-x) into the text field, then go back to the top of the page and click “Update Options” and you’re done. If you’re using a caching plugin, make sure you clear the cache.

Adding Google Analytics to Shopify

Shopify is a great site to launch an online shop almost without the need of work done by developers. You can add Google Analytics to your Shopify shop simply by logging into your Shopify admin portal, then go to “Online Store” and “Preferences”. There you will find one input area labelled “Google Analytics”. Next, copy the tracking code from Google Analytics and paste it into this text field. Then click “Save” and you should be done. Make sure you copy the full tracking code starting with the opening <script> tag and ending with the closing </script> tag.

Most general way to add Google Analytics to any website

If you know your way around HTML, you can also add the tracking code directly into your website’s code. To make the analytics code work best, simply copy the tracking code and paste it directly after the opening <body> tag of your site. Make sure you copy the full Javascript code starting with the opening <script> tag and ending with the closing </script> tag. Also make sure, the code then shows up on all pages of your website which you want to have tracked.

Final remarks

To end this quick tutorial, two final remarks. First is that you won’t immediately see visits to your website in the standard report. To be able to check if everything works it’s best to go to Reporting (in Google Analytics), then pick your website clicking on “All Web Site Data” which will open the Audience overview section. To see what’s currently going on on your website, click on “Real Time” and then on “Overview”. If everything was set up correctly and you yourself visit your website, then you should see some “Page Views” showing up in this report.

Second topic is a legal one which I can’t advise you on anything, because I’m not a lawyer, but I can make you aware of it. Google Analytics is collecting data and depending on where your website is hosted and under which jurisdiction it’s published, the implications regarding privacy and other topics vary. Make sure you get information in that regard before you launch your website or connect it to Google Analytics and talk to a lawyer about the legal sections on your website. Unfortunately, we can’t help you with that part of your website, we’re not qualified for things like that.

Share this Article

About the Author

Wolfgang GeigerWolfgang Geiger is founder, director and lead developer of Wohok Solutions. Passionate about website development from an early age, Wolfgang has built websites for more than half of his life. He has degrees in both, Computing and Business Management and is fluent in German, English and Mandarin. In Hong Kong he enjoys the mix of East and West, the energy in the city and the fabulous local food.

Get in Touch

Do you have any comments or questions? Get in touch, we'd love to hear from you!

Name

Email Adress

Company

Message