
Oyster Web Tutorial
Adding Google Analytics to Your Website
![]()
by Robert Morrison
of http://www.oyster-web.co.uk
Step By Step -
Google Analytics Web Design Tutorial
1. A Google account is required
If you haven’t already signed up for a Google account for services like G-Mail, or Webmaster Tools then you’ll have to create one to gain access to the Analytics system. The signup procedure is quick and easy, asking for the following information:
- Email
- Password
- Location
There are also two optional values:
- remember me
- web history
These can be safely unchecked for now and will be explained in another article.
There is a CAPTCHA which must be correctly identified, with an audio version for users unable to see the image version. Finally, by clicking on the ‘I accept. Create my account’ button you are agreeing to Google’s term and conditions.
2. Sign Up for Analytics
Some further personal details are required to sign up for analytics, and acknowledgement that you agree to the terms and conditions. One point of note is that Google will use the statistics they gather about your site for their own uses.
3. Copy-and-Paste the JavaScript (with your personal ID)
You will be presented with a short block of HMTL that you must add to each of your web-pages that you’d like Google Analytics to track. Within the HTML block is some JavaScript code that implements all the tracking functionality. Be aware that a Cookie is set on your visitors’ browsers which may mean you need to update or publish your privacy policy.
This is the most technical section of the tutorial and so it should be completed by someone with an understanding of how your website is constructed. Depending on the technology that drives your site the implementation will differ. To install Google Analytics on a basic, static, HTML page the code block (from step thee) is inserted “immediately before the closing </BODY> tag” (or thereabouts really). Do this to each page in the static site and you’ll be able to track each of them.
For dynamic sites you must make sure that the code block appears in the rendered page in the correct place, but the means to do this will differ. The easiest situation is a template-based website where the code block can be pasted into the template (or templates if more than one are used). Alternatively the dynamic page might be build as a series of code ‘includes’. In this case the code that handles the end of the HTML document (such as the footer, etc) can be amended to include the code block as part of its normal job. Of course, this means that Google Analytics will be active on all of the dynamic pages, if this is not your intention then a more intelligent solution will need to be implemented.
4. Watch the results Roll In!
Approaching the techniques of analysing of your results is worthy of a tutorial in itself, The way you interpret and use the information gleaned will vary depending on the objectives you’ve set for the website. That said, general information is easy to find: answers to ‘how many people are visiting your site’, ‘what are the busiest times of the day/week/month/year’ can be found at-a-glance.





Bookmark this page with: