Basic Installation Of Google Analytics

The basic implementation of Google Analytics is a relatively straight forward process. Tracking is achieved by adding a snippet of JavaScript code to all the pages on the website that you wish to record statistics for. The tracking code is supplied during the Analytics account setup process, but it can also be found in the settings for the site’s profile within the main account. To find the code, sign into your account, go to the ‘Analytics Settings’ page and select ‘Edit’ on the profile for which you require the JavaScript code. Clicking on ‘Check Status’ in the top right hand corner of the ‘Main Website Profile Information’ box will bring up the tracking code.

The Google Analytics tracking code is specific to each profile in an account, which is why it is accessed via the ‘Profile Settings’ page for each individual Analytics profile. The code shown below is an example of what the JavaScript will look like. The “XXXXXXX-X” in the example represents the position of the unique Google Analytics account number automatically assigned to your website profile.

<script type=”text/javascript”>
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script type=”text/javascript”>
try {
var pageTracker = _gat._getTracker(“UA-XXXXXXX-X”);
pageTracker._trackPageview();
} catch(err) {}</script>

Once you have the code, copy and paste it into the bottom of your website content, before the </body> tag of each page you are planning to track. If a common include file/template is utilised, then you can enter it there to save manually copying it into every page. There are instances when the tracking code could/should be inserted elsewhere on a page, but this doesn’t occur that frequently and wouldn’t necessarily be considered as part of a basic implementation of the Google Analytics code.

When you’ve finished installing the tracking code and have updated your site’s pages, you should start to see data arriving in your Analytics account after approximately 24 hours. Although it has been known to take longer for data to appear in some cases. You can use the ‘Check Status’ function in the Analytics profile to see if the installation was successful and if the account is now awaiting or receiving data.

Andy Keech posted at 2010-3-3 Category: Google Analytics

Leave a Reply

(Ctrl + Enter)