How to Set Up Google Analytics for WordPress The Right Way – Search Engine Optimization (SEO)

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

When you first create your Google Analytics account, Google will provide you with a JavaScript tracking code to add to your site. This code just needs to be added to the element in your site’s HTML. Easy, right?

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.

Google Tag Manager Logo

Install the tracking code using Google Tag Manager

If you really want to get ahead of the curve, you can install Google Analytics using Google Tag Manager. GTM is a relatively new Google service that allows you to manage all of your site “tags” in one place. Google Analytics isn’t the only service that will want to add some code to your site; ad networks, social media sites, and CRM software will all have JavaScript for you to add. Google Tag Manager lets you install a single tracking code on your site, and then handle all your other tracking codes from the GTM dashboard.

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.

Leave a Comment


Work With Us

We've been building websites for over twenty years, and have learned a thing or two about how to make web projects go smoothly.

What Our Clients Say

Watermelon Web Works, LLC place picture
4.7
Based on 19 reviews
powered by Google
OMS Anita profile picture
OMS Anita
22:20 29 Nov 24
Watermelon Web Works has been incredible to work with. They are patient, understanding, and quick to answer any questions (or emergencies) you might have. After switching over to them to help re-vamp our online retail store, we hired them to build our wholesale website as well. I can't recommend them enough - Thank you team!
Garrett Lister profile picture
Garrett Lister
19:55 10 Jul 24
Jared and the watermelon team were great - they quickly interpreted our website needs and designed a wonderful site. The project management site worked great to keep track of project.
N B profile picture
N B
21:23 14 Nov 23
My previous web developer who I was very happy with retired and I was pretty sad about it because it seems now days it is hard to hire a web developer close by with a good set of skills who is interested in helping small business at reasonable prices. Then I found Watermelon and I have been very happy. They are responsive, are able to solve problems, and work at reasonable prices.
Dark Star Magick profile picture
Dark Star Magick
18:05 03 May 23
We hired Watermelon to help us with our website. They were very thorough and took the time to explain in layman's terms what they were doing and how we could improve SEO and site functionality. We will definitely be back for future website needs!
Astoria Column profile picture
Astoria Column
18:42 24 Apr 23
Great work and amazing service! We're a non-profit, and our priorities are always focused on maintaining the Astoria Column. We had a website built by someone else a few years ago, but without regular updating and maintenance, sections of our site were no longer functional. Joanna and the rest of the team came in and had everything working within a week and it's been smooth sailing since then!
Ben Harris profile picture
Ben Harris
19:25 26 Aug 19
Watermelon has been a fantastic web development partner. Through every phase of our project they have always been 100% responsive to our requests and have always provided highly knowledgeable, creative, prompt, and personable team members to work with. As a financial institution we’re always concerned about the security and maintenance or our website and Watermelon has always provided the appropriate resources in order to meet and/or exceed our compliance and security requirements. We would surely refer them to any business associates looking for a qualified WordPress web designer in the future. – Denali Federal Credit Union
Mohr IP Law Attorneys profile picture
Mohr IP Law Attorneys
00:33 11 Apr 19
Watermelon Web Works did a great job creating a custom shopping cart page for our firm. Gavynn in particular was especially helpful and responsive. We appreciated the upfront costs and the technical competency of Watermelon Web Works and would not hesitate to work with the people there again.
Kim Markle profile picture
Kim Markle
23:36 08 Feb 19
Our company has been working with the Watermelon team for more than 10 years to help build and grow our website and customer portal. They are not only extremely talented and responsive, but are continuously looking for ways for us to enhance our current website. They are consistent, provide excellent customer service and really know what they are doing. Highly recommend!
Rick Brodner profile picture
Rick Brodner
23:23 12 May 17
I cannot say enough good things about Watermelon. They are terrific communicators, highly competent coders, and really, really nice people. They were instrumental in helping us to assemble a very usable, easily maintainable website for our organization. They' have demonstrated great flexibility in accommodating our evolving needs. They have been highly responsive to any technical issues, typically resolving them in less than 4 hours. Watermelon Web Works will make your organization better, and your CFO/Treasurer will be happy when they see the bill - what more can you ask for?
CLOSE