Google Analytics Tracking Code

Introduction

  • The Google Analytics (GA) tracking code collects visitor data for your website.
  • The tracking code contains a unique ID for your website.

Setup up the web tracking code

  1. Register or login to GA
  2. Add your website as a property
  3. Find the tracking code: Admin > select property > click the tracking info tab
  4. Turn on the tracking options you want, then click Save
  5. Copy and place the code snippet just before the closing head html tag
  6. Verify and customize

Ecommerce Tracking

  • First you need to enable ecommerce tracking from your Analytics account.
    • Admin > Choose account > Profile > Profile Settings > Under the E-Commerce settings option, select Yes, an E-commerce Site/App > Click Apply
  • The you need to add Ecommerce tracking to your website
    • Create a transaction object. Use the _addTrans() method
    • Add items to the transaction with the _addItem() method
    • Submit the transaction to the Analytics server with the _trackTrans() method