Google analytics is an incredibly powerful data analytics platform that can give you invaluable information about your customers when utilized properly. From website traffic metrics, to user behavior and page flow — Google Analytics can track customer through your sales funnel and show you how to properly capture value on your website through usability testing and customer insight.

Setting up Google Analytics

Setting up Google Analytics is a rather straightforward process. Many WordPress themes and plugins will facilitate the process of setting up your Google Analytics but we’re going to show you how to manually set this up for any web platform.

Create a Google Analytics account

First, you’ll need to create a Google Analytics account and add a property (aka website). Once you’ve created a Google Analytics account, you’ll want to visit the admin page to add your first property to start tracking website data. Click “Create Property” and follow the on screen prompt to complete setup — including your Website Name to identify this property among other future Google Analytics properties and Website URL (the web address of your website). Once you’ve entered the website information and clicked “Get Tracking ID” — you’ll then want to get your Google Analytics tracking code.

Google Analytics Admin Dashboard

Get your Google Analytics tracking code

Once you’ve created the property, click “Tracking Code” under property settings “Tracking Info” (or if you just created the property, you’ll be taken there automatically). Here you’ll look for “Global Site Tag (gtag.js)”. If you’re not familiar with javascript, don’t worry, you don’t need to understand the code — simply highlight and copy this entire code block. Next, we’re going to add this code to your website.

The code block will look something like this:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="[YOUR ID HERE]"></script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments);}
 gtag('js', new Date());

gtag('config', '[YOUR ID HERE]');

Adding the Google Analytics tracking code to your website

While this will vary depending on your website platform, it’s still rather straightforward. You’ll want to navigate to your website code via FTP or backend management system and find the website file that contains the header information of your website (in WordPress this is header.php). You simply want to paste the Google Analytics code block that you copied earlier above/before this closing head tag (the closing head tag will be </head>). Typically you want to include javascript files in the footer to avoid render blocking javascript and improve page performance but in this case, Google Analytics code needs to be in the head to load prior to page elements for improved data measurement.

Ensuring successful Google Analytics setup

While it takes a moment to fully start tracking website data, you can verify that your tracking code is working by visiting the Reports > Real Time > Overview of your Google Analytics dashboard. If you or your users are currently viewing your website, you should see user data populate the Real Time view on Google Analytics.

Real Time View on Google Analytics

Setting up Conversions in Google Analytics

Now that you have website data populating your Google Analytics dashboard, you’ll want to make use of this new data by setting up goals and conversions. A conversion is the process of converting a website visitor into a lead or customer. By assessing where your customers are at in the sales funnel and where there may be falloff, you can adjust your web strategy and increase conversions — generating more revenue for your business!

Creating Goals in Google Analytics

First, visit the admin page of your Google Analytics. Next, click Goals in the right “View” column of this page. This Goals page is where we’re going to tell Google Analytics what a conversion means on our website. A conversion can be a purchase, a form submission generating a lead for your business, or a simple button click. These actions are called Events and we want to tell Google Analytics which events are worth tracking and which events generate conversions for the business.

On this page, click “New Goal”. First, you’ll be on the Goal Setup page — from here you can use a predefined template created by Google Analytics or you can create a custom Goal, we’re going to create a custom goal by clicking “Custom”. Next, we’ll need to attribute a Goal description to this new Goal. You’ll want to use a name that appropriately identifies what value this action provides to the business. For example, in this example, we’ll be creating a Goal which tells us when a user has submitted a contact form which generates a lead for our business. We’ll call this goal “Contact Form Lead” and we’ll set the Type to “Event”.

Google Analytics Goal Setup

Next, in the Goal details page, we’ll need to add a Category, Action, Label, and Value to the Goal. A Category helps identify the Goal if it were to be categorized among other future website goals, the Action is the user action that takes place (for example, a user clicking the submit button on our contact form), a label helps your website recognize the action, and the value is the business defined value you’d like to attribute to this action (this value is completely up to you, you can leave this blank — or if you have an idea of what a lead is worth to your business, you can assign a dollar amount to this action here). Once you’ve filled out the necessary fields, click Save to complete the Goal setup. Next, we need to include tracking code on the button we want to connect to the Goal.

Adding tracking code to the conversion target

This is the part Google does not show you how to do — which can be incredibly frustrating for any website owner!

Depending on which website platform you’re using, you’ll need to access the code of your website once more. What we want to do here is find the HTML element we want to add our tracking code to (in this example we’re looking for the code of the submit button on our contact form). Once you’ve found the element, we’re going to add an onClick event to tell Google Analytics when a user action is taking place.

Submit button HTML

The onClick code that we’re going to add uses the Goal data that we set up in Google Analytics and is structured as follows:

onclick="ga('send', 'event', 'Category', 'Action', 'Label');"

In our example, we’ll be adding this code to the contact form button and the result will look like the following:

<input type="submit" value="Send Message" class="wpcf7-form-control wpcf7-submit" onClick="ga('send', 'event', 'Form Submission', 'Click', 'Contact Form Submission');">

Once you’ve added the onClick event to your button or action element, you’re all set! Moving forward, whenever someone takes the action you defined in your Google Analytics Goal, your Google Analytics data will display a new conversion! Next, we’ll show you where to see this conversion data in your Google Analytics dashboard.

Viewing Conversions in Google Analytics

While the data can be structured and viewed in incredibly complex ways to give you powerful insight about user behavior and user action, we’re going to show you the basics.

First, navigate to your Google Analytics admin page and click Goals once more. Here you’ll be able to view current Goals and their individual structured data metrics including Goal, ID, Goal Type, and Past 7 day conversions (“Recording” shows whether or not the goal is currently active and tracking).

For further conversion data, you can navigate to the Google Analytics dashboard and click Behavior > Events > Overview to get a simplified overview of your current Events and Conversion metrics.

Google Analytics Behavior Events Dashboard

Lastly, you can view even more data from your Conversions > Goals > Overview dashboard, see below an example of some of the data you can extract from this view.

Conversions overview Google Analytics


If you’re a marketer, code can be intimidating — if you’re a developer, knowing what’s valuable to the business may be difficult to determine. Although we’ve tried to simplify the process and data down to make sense for all parties involved — hopefully the above information puts you in the right position to dive deeper into customer data and extract valuable information to make your business a success online! If you need help getting started, or would like to talk to us about setting up a similar data analysis and conversion profile for your website, contact us today or shoot us an email directly at!

Bryan Miller of Bryt Designs Long Beach Web Design, Development, & SEO
Bryan Miller

Bryan Miller is an entrepreneur and web tech enthusiast specializing in web design, development and digital marketing. Bryan is a recent graduate of the MBA program at the University of California, Irvine and continues to pursue tools and technologies to find success for clients across a varieties of industries.