How to Plug Google Analytics Into Your Site

Google Analytics is a free service to track your website’s visitors, but you have to get into your site’s back end so the service can collect the data you’re asking for. Here's how.

May 14, 2014

If you have a site that is using Blogger, WordPress, or Squarespace to serve up your content, you shouldn’t have to touch the underlying code to connect with Google Analytics.

Otherwise:

  1. Go to google.com/analytics and either sign in or create a new account.
  2. Name your Web tracking account, enter your URL information, and let Google know if you want to share information with it (if you don’t, you’ll miss out on some page-ranking data), agree to the service terms, and click the “Create Account” button.
  3. Click on the “Tracking Code” tab.
  4. Tell Google how you want to group your data.
  5. If you have a simple domain, stick with the default.
  6. If you have subdomains (say, you want to track both store.yourdomain.com and www.yourdomain.com), choose the second option.
  7. Choose the third option if you want to roll the analytics of two separate domains into one reporting suite (yourdomain.com and stevesdomain.com).
  8. If you have an AdWords account, link it by checking the related box.
  9. Copy the code that Google Analytics provides at the bottom of the page.
  10. Open your site’s CSS code and add Google’s code into your site’s templates. Paste it in before the closing </body> tag.