Quick Links

Google Analytics is a powerful tool for tracking metrics on user behavior, like clicks and bounce rates. It's entirely free to use, so if you want to know how your site is performing, there's no reason not to set it up.

What Does Google Analytics Do?

On the surface, Google Analytics simply provides you a way to track your website metrics. If you want to know how many users you have this week compared to last week, you can do that. If you want to know how long users spent looking at a particular page, it can do that too. It tracks most kinds of data around sessions and clicks.

Analytics also allow you to make better business decisions. Every business's website has a goal, whether that's increasing traffic to the site itself, or selling a service or product from that website. Analytics help point you in the right direction, and good analytics are the backbone of many online companies.

For example, if you're publishing news stories, analytics can tell you which stories do well and which stories readers bounce away from quickly. If you're selling products, analytics can tell you what users are clicking on the most. Analytics can also inform you about your target demographics, as it can track devices, countries, and even augmented data like gender, age, and interests.

Most analytics suites, including Google Analytics, offer A/B testing, which is like the scientific method for websites. Basically, you show one design to half your users, and a different design to the other half, and after a week or so, you go with the design that performs better. Good analytics power A/B tests, as they wouldn't be possible without them.

Setting Up Google Analytics

Head over to the Google Analytics dashboard and sign in with your Google account of choice. If this is your first site using it, you can simply click the "Start Measuring" button to set it up.

If you have an existing site, you'll need to click the settings icon in the bottom left and click "Create Account" to add a new one.

You'll need to fill out some basic info, mostly just setting a name for the property and website.

Once that's done, you'll need to set up a stream to ingest data. Click on "Web" to set it up for a website:

You'll need to enter your site name as well as a tracking ID (you can have multiple ingest sources, if you'd like to) and click "Create Stream":

You'll be given a script that will link your site and Google Analytics. You will need to include this code somewhere on your site, wherever you'd like this stream to capture data from. If you have multiple streams, you'll need to add it to an existing on-page tag.

Depending on your website architecture this can go many places, but typically it will go in your Index.html as well as every other page on your site. If your site isn't making use of any frameworks, you'll have to copy and paste this onto each page.

If you are using frameworks like React, Vue, or Blazor, you'll need to simply include it in your "root" HTML file, which usually defines all global scripts and styles and provides a root element for the page to render into.

You can place it at the bottom of the

        body
    

 tag in either case:

If you're using WordPress, you can read our guide to setting it up with a plugin, or add it manually to your site files.

At this point, your site should be linked, but unfortunately it will take 24-48 hours for most analytics to start coming in. In the meantime, you can verify that it's actually linked by checking if you're receiving any data under the "Realtime" tab.

Using Google Analytics

On your home page, it will display some basic useful analytics like user count, page views, and engagement. You can filter these by date as well as view certain statistics in real time.

Using "Behavioral Flow," you can track users across multiple pages, and view how they use your site based on the string of their interactions.

A Google Analytics Behavior Flow page.

Under demographics, you can view more info about the users using your site.

There are multiple tabs for tracking the user life cycle, such as:

  • Acquisition, which tracks how users are finding your site in the first place,
  • Engagement, which tracks how users are using your site when they get there, and
  • Retention, which tracks if users are coming back to your site.

There's also "Monetization," which is only enabled if you have your ad or ecommerce accounts linked.

Google Analytics tracks page views after users get there, but if you're interested in learning about how your site is performing in search results, you should use the Google Search Console.