Hey, good to see you again! I hope you enjoyed the first lesson and that you’re looking forward for the next ones.
Before starting with Google Analytics you need to create an account and install the tracking code on your website. The tracking code will send Google Analytics data about how your visitors interact with your website, data which will later be presented to you in some fancy reports.
How to create a Google Analytics account
In order to create a Google Analytics account, you will first need a Google account. But don’t worry, you will get one while you’re signing up for Google Analytics.
So, head over to http://www.google.com/analytics/ and sign up for a Google Analytics account or access you account if you have one.
During the setup you will need to fill in some information, such as your website name, contact information and finally you will get the tracking code.
First, you will need to enter your website URL along with the name you want for your account (this can be changed later).
Then, you will need to enter your contact information, accept the user agreement and get to the final step when you will receive the tracking code.
Before copying the tracking code, make sure that you are selecting exactly what you are looking to track:
- A single domain – just your blog/website
- One domain with multiple subdomains – you should select this if you are using subdomains and want to track them separately
- Multiple top-level domains – this option helps you if you have multiple websites and want to track them as a single website; but, personally I would track each of them separately
Additionally, if you are using or planning to use Google AdWords, make sure you select the [AdWords campaigns] option. On the [Advanced] tab, you can find more options available which are useful if you are tracking online campaigns from other providers, track dynamic content or use Urchin software. But we will stick with the basics for now.
Once you fill in all the information and select your desired options, it’s time to add the tracking code on your blog/website.
For start just copy the code and save it on you preferred word editor.
The tracking code should look like this, where [UA-12345678-1] is your Google Analytics account number:
var _gaq = _gaq || ;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’); s.parentNode.insertBefore(ga, s);
This line of code will activate the speed tracking for your website and you will start to see data in the [Site Speed] report available in the [Content] section:
Install the tracking script on your site
Before adding the script to your website, you should know that there are 2 places where you can add the tracking script and each of them has advantages and disadvantages.
- In the Header
- Advantage – The tracking code is able to track all the visits even if the visitor leaves before all the page gets loaded
- Disadvantage – The script placed before the content may increase the load time of your pages because it is loaded before the content
- In the Footer
- Advantage – The pages load faster because the content is served before the script and the visitor will not notice any possible delays
- Disadvantage – The script might not track all the visits, if for example someone lands on the website and exits immediately
Now, once you decide where to place the code, go ahead and edit your HTML files in order to add the tracking code and start seeing results in your Google Analytics account.
Install the tracking script on WordPress
If you are using WordPress, then installing the tracking code becomes darn simple, because the Google Analytics for WordPress plugin will do for you all the hard work.
You can simply copy the tracking code in the head or footer section of your WordPress theme, but there are some nice features you would not want to miss.
To simply add the code to your theme, go to the [Appearance] section and select [Editor]. If you are using a fancy paid WordPress theme, then you should be able to do it easier from your custom options.
Now, back to the Google Analytics for WordPress plugin. First you will have to authenticate into your Google profile and grant access for Google Analytics for WordPress on your Google Analytics account.
One of the most important things you need to make sure at this step, is that the tracking code is properly installed on your website.
Once Google Analytics is able to get data from your website, you will notice it in the reports section.
That’s all for today! I hope you have your Google Analytics account ready, because on the next lessons we will dive into it to get some useful insights.
Now, that you’ve also finished the second lesson of the “Google Analytics – From 0 to Analysis Ninja” course, I want to offer you the second Shuriken. Kudos to you!
Along the journey, you will receive one for each lesson you complete and at the end you will become a truly Analysis Ninja. Aren’t you excited about this?
In the next lessons I will show you how to add the goals you just set up in this lesson into Google Analytics and what are the 10% features of Google Analytics that will give you 90% results.
I am really excited to have you with me and I hope that you will get the most out of this course. If you do, don’t forget to spread the word. It’s free!
If you’ve got here from a friend or Twitter without being subscribed, this is the Lesson #2 from a multi part course about Google Analytics. Click here to learn more about it and sign up to the “Google Analytics – From 0 to Analysis Ninja” course. This way, you can’t miss any lesson.