In this part of our Small Business SEO series, we are going to cover Google Analytics 4 and key events tracking. The goal is to be able to track website visits and events like page views, mobile phone calls, form submissions, and email link clicks. This is going to be a basic set up that will work for most small business websites and isn’t meant to be an in-depth guide. This is meant to give some helpful guidance on getting a basic installation to track website visits and a few key events that are common for most businesses.
If you don’t have a Google Analytics account, you’ll want to do that first. Go here to learn how to set that up: https://support.google.com/analytics/answer/9304153?hl=en
Once you have your Google Analytics account, you’ll want to put the tracking code on your website. Let’s look at a few ways to do that.
1) WordPress Websites. The easiest way to set up Google Analytics tracking on WordPress is to get an analytics plugin. There are a few very popular ones.
With Google Site Kit or Monster Insights, you’ll have 2 options to connect to Google Analytics 4 (GA4). You can either connect via authenticated login where you’ll click the button in the admin to connect the account and login to grant access, or you can manually enter your GA4 tracking ID. The tracking ID is a unique ID that usually starts with a “G-“. If you have a hard time finding your Google tag ID, follow the instructions here: https://support.google.com/analytics/answer/9539598?hl=en
If you want to manually add the Google tag code to WordPress (the actual code that tracks website data), you can get the full tag code in the “Data Streams” section in the admin. Info on how and where to get that is also here: https://support.google.com/analytics/answer/9539598?hl=en
Copy the full tag code, and open up the WPCode plugin. Look for the “Global Header and Footer” section where you can place the code. Place the code in the header and save the changes. We’ll come back here for some additions to track key events, so you can leave this open for now.
2) Other Websites. Most website CMS platforms like Shopify, Wix, Webflow, and others will have a place to drop your Google Analytics ID that we found before. Look for the site setting and analytics area to add this ID. Here are a few links to popular CMS providers on how to do that.
For static or custom sites, you can place the full Google tag code in the header (specifically, the <head> section) of the website theme before the closing </head> tag. Remember this, as we will also put some additional scripts here later.
Another option for managing your Google tag code is the appropriately named Google Tag Manager (GTM). The Google Tag Manager allows you to drop in a script once on your website and manage all the code snippets from an admin area in Google Tag Manager. For more info on this, you can visit the introduction page for Google Tag Manager here: https://support.google.com/tagmanager/answer/6102821?hl=en
GTM has features to easily add Google Analytics tracking code (https://support.google.com/tagmanager/answer/9442095?hl=en) and add key events (https://support.google.com/tagmanager/answer/13034206?hl=en&ref_topic=6333310&sjid=12467287551155454115-NA) as well as custom scripts (https://support.google.com/tagmanager/answer/6107167?hl=en).
If you choose to go this route, you can implement this on any of the website solutions, but you’ll be learning the ins and outs of the Google Tag Manager system. It’s not complicated but can be a little bit of a learning curve. One of the benefits of using tag manager is that you just have to edit website code once, and then you can manage scripts from the admin area of GTM. You can also grant access to users so others can manage what is in Google Tag Manager, so there are some benefits to going this route.
Out of the box, the Google Analytics 4 tracking will track standard website analytics like page views, visits, time on site, and engagement. These are a good starting point to understand how users are interacting on your website, but they don’t give us the “Key Events” we want to track. Key Events are events that are tracked as goals, and the three Key Events we will be adding are form submissions (contact form, lead form, email subscriptions, etc), mobile click-to-call events, and email address link clicks.
These events are typically tied to leads or prospects, and tracking these key events tells us how well our website is turning visitors into leads and prospects. For a small business, these key events are a critical component of earning new business, so we’ll focus on how to track these.
We can use something called “event listeners” to trigger a key event in Google Analytics any time someone performs the actions we want. For instance, we can set up some javascript to listen for any time someone clicks the “submit” button on a form and send that to Google Analytics as a Key Event.
Below is a script that has 3 event listeners to trigger an event when someone submits a form, clicks a phone number link, or clicks an email address link.
<!-- Google Analytics 4 GTAG Conversion Event Listener Phone Calls -->
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll("a[href^='tel:']").forEach(item => {
item.addEventListener('click', function() {
gtag('event', 'phonecall');
})
})
});
</script>
<!-- Google Analytics 4 GTAG Conversion Event Listener Email Clicks -->
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll("a[href^='mailto:']").forEach(item => {
item.addEventListener('click', function() {
gtag('event', 'email');
})
})
});
</script>
<!-- Google Analytics 4 GTAG Conversion Event Listener Form Submissions -->
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll("form").forEach(item => {
item.addEventListener('submit', function() {
gtag('event', 'form-submit');
})
})
});
</script>
These 3 scripts will track any and all clicks on form submissions, phone calls, and email clicks and send those to Google Analytics. Next, we’ll set up these events as Key Events in Google Analytics so we can see them as goals.
Copy these 3 scripts and paste them into your website. If you are using WordPress and WPCode, paste this in the Header section where we added the Google Tag code AFTER the Google Tag code. If you are using Google Tag Manager, add this as a custom script in the header. If you are using any of the other solutions, you’ll want to add this code to the <head> section AFTER the Google tag code. Once published, these scripts will start sending key events to Google Analytics. These events are named “form-submit”, “email”, and “phonecall”. You’ll want to remember those for the next step.
Follow these guides from Google to set up key events within Google Analytics to 1) Set up key events (https://support.google.com/analytics/answer/12966437?hl=en) and create or modify key events (https://support.google.com/analytics/answer/12844695?hl=en). These two guides will familiarize you with what a key event is and how to create is and track it in Google.
The easiest way to get this done after the scripts are added to the website is to do all three actions. Submit a form, click the phone call link, and click an email address link. Then, wait a few hours, maybe even 24 hours. In the “events” section in Google Analytics (Admin > Data Display > Events), you can see all the “existing” events that Google has tracked. Next to the ones you want to track as Key Events, use the toggle to mark them as Key Events. If you have implemented Google Analytics 4 tag, and the scripts correctly, you’ll see your new events listed here. It can take several hours or even a day for new events to populate here, so be patient and check back later if you don’t see them immediately.
You can see all the events including Key Events in the Reports > Events area of Google Analytics 4 to see how often these are occurring.
To see how channels perform, you can visit Acquisition > Traffic Acquisition to see the key events by traffic channel. This will help you get a view into these key events and their totals by traffic channel.
Now that you have some insight into how each marketing channel is performing, you get some up-to-date feedback on whether your website is doing its job to convert visitors into interested prospects or leads. You may weight phone calls and form submissions as the top two key events as these two are most likely to create a revenue opportunity. If you are embarking on doing your marketing in-house, this approach will give you metrics to know if it’s working or not. If you’re working with an agency, you can know what key events are being tracked and how they perform. This gives some valuable feedback on how to allocate resources towards what is working and refine what may be under-performing.
There is a lot here, but we wanted to give our small business audience a path to execute some of the things that will help them as they grow. If you reach the point where you need help, feel free to reach out. We can help with everything from setup to providing marketing solutions for small businesses.
Categories: SEO, Technical SEO, Websites, Wordpress
Recognized by clients and industry publications for providing top-notch service and results.
Contact Us to Set Up A Discovery Call
Our clients love working with us, and we think you will too. Give us a call to see how we can work together - or fill out the contact form.