Google Analytics is the default choice for tracking traffic on your website. If you want your site to rank on Google’s search results, you really can’t go without it. It’s free, easy to use, and easy to install. It’s so easy to install, in fact, that there are countless WordPress plugins designed just for that. But with so many choices, it’s not always clear how to set up Google Analytics the right way.
Install the tracking code using a plugin
If you run a WordPress site, you probably know about plugins. These tiny addon downloads allow you to add extra features and functions to your website that WordPress doesn’t offer by default. And if you’re wondering how to set up Google Analytics in the simplest and easiest way possible, the answer is by using a plugin.
There are tons of different plugins you can use to add your tracking code to the site. Some themes even have a Google Analytics tracking code field in their theme options, so check there first.
If you do decide to use a plugin, there are several options. You could use a plugin like Insert Headers and Footers to add the tracking script to your site code. This is a simple, lightweight solution that won’t slow down your site. There are other plugins that go above and beyond adding the tracking code to the site; they offer reporting, integrations, and other new features.
Install the tracking code manually
Well, if you’re like most people, you may be using WordPress because you can build a website without touching any code. You may have no idea what HTML or aelement even is. If that’s the case, you may need a developer to help with a manual installation, or use a plugin to install your tracking code.
By installing the tracking code manually, you don’t have to add an extra plugin to your site, reducing plugin bloat and keeping your site fast and lean. Rather than using a plugin, you or your developer will likely want to create a child theme and modify the theme files to add the tracking script. Be careful not to edit the parent theme files, or your code will be removed the next time you update your theme.
Install the tracking code using Google Tag Manager
Google is making a push towards using Tag Manager, and it’s a useful tool to have on your site. Still, setting up GTM requires adding a tracking code of its own, so you’ll still need to decide on your preferred method for getting that in place. And before you ask, gtag.js isn’t the same thing as Google Tag Manager.
Integrate Google Analytics with other plugins
Google Analytics enables most features by default, but a few require some additional configuration.
You can use Events to track specific interactions on your website. Unless you’re comfortable writing your own code to fire off these “events,” then Google Tag Manager is the best way to start tracking custom events. There is a UI that will guide you through the process of setting up an event without ever touching a single line of code.
Ecommerce tracking is another powerful feature that requires additional set up. Trying to do this manually is complex, and it’s much easier to use a plugin to get Enhanced Ecommerce tracking in place. If you’re using WooCommerce, they have a plugin that will handle eCommerce tracking right out of the box.
Google Analytics is an invaluable tool for seeing how users are interacting with your site. Regardless of which method you choose to install the tracking code, the data will be accurate. Don’t overthink how to set up Google Analytics too much; the most important thing is to start collecting data as soon as possible so that you can make informed decisions about your website. Once you start working with Google Analytics, you’ll open a whole other Pandora’s Box of questions, wondering about time-on-site versus time-on-page and asking about the differences between users, sessions, and pageviews. When you get there, be sure to check out our guide on how to use Google Analytics.
And if you run into any trouble setting up Google Analytics, just give us a call.