How to Setup Google Analytics on Your Website

Google Analytics is a service offered by Google that generates detailed statistics about a website’s traffic and traffic sources and measures conversions and sales. It is the most widely used website statistics service and the basic service is free.

Creating your first Google Analytics account

  1. Visit http://www.google.com/analytics.
  2. Click Create an account and follow the instructions.

Note: If you are already an AdWords user, you can create a new account within AdWords: Click Tools and Analysis > Google Analytics, and follow the instructions.

If the website you want to track is not created during the account setup the steps below outline adding a property (website or app) to your Google Analytics account, if you already have your tracking ID skip ahead to Installing the Web Tracking Code.

Add a property

  1. Click Admin at the top of any Analytics page.
  2. In the Property column, click the menu, then click Create new property.
  3. Select whether you want to track a website or an app:
  4. Select an industry category that reflects the content of your site or app.
  5. Select the time zone you want to use as the day boundary for your reports, regardless of where the data originates.
  6. Click Get Tracking ID.

Installing the Web Tracking Code

Installing the web tracking code requires access to the source code for your website, if you would like WiseInternet to install the code on your behalf contact us with your request.

If your website is powered by WordPress please visit our Install Google Analytics on Your WordPress Website article for installation options.

  1. First, find the tracking code snippet for your property.
    • From any Analytics page, click Admin.
    • Select the property you want to track.
    • Check that the URL at the top matches the one for your website.
      If the settings are showing the wrong web property, click the link in the breadcrumb trail for your account, and select the correct property from the list.
    • Click the Tracking Info tab.You’ll see something similar to the code snippet below, where XXXXX-Y indicates the property ID.
      <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXX-Y']);
      _gaq.push(['_trackPageview']);
      (function() {
      var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
      ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
      var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
      })();
      </script>
  2. Turn on the tracking options you want, then click Save.
  3. Copy and place the code snippet
    Once you find the code snippet, copy and paste it into your web page, just before the closing </head> tag*. If your website uses templates to generate pages, enter it just before the closing </head> tag in the file that contains the <head> section. (Most websites re-use one file for common content, so it’s likely that you won’t have to place the code snippet on every single page of your website.)

    For the best performance across all browsers we suggest you position other scripts in your site in one of these ways:

    • before the tracking code snippet in the <head> section of your HTML
    • after both the tracking code snippet and all page content (e.g. at the bottom of the HTML body)
  4. Verify and customize
    Verify that your tracking code contains the correct web property ID for your view (it should if you copied it from the View Settings screen). Double-check that the tracking snippet installed on your website matches the code shown in the view. For more details on verifying your setup, see Verifying your setup.Add any customizations back in using the asynchronous syntax. The Usage Guide and Migration Examples (English only) on Google Code provide many examples of customizations with asynchronous tracking.