How to add Google Analytics to your WordPress Website

Linear Flat visitor analytics website hero image vector illustration. SEO, SMM and online marketing concept. Laptop, tablet with report data on screen.

If you’ve got a website, you probably want to know how many visitors you have, how they’re getting there, and what they’re doing on your site. Enter Google Analytics. There’s non-Google options out there if you’re in the anti-Google camp, but that’s the subject of a future article.

Google Analytics is an incredibly powerful tool with a whole host of options and settings which are the subject of other great resources. To make use of those, you’ll first need to connect analytics to your website. Here’s how to do that:

Option 1: Google’s Site Kit Plugin

Google makes an excellent lightweight plugin for WordPress which lets you connect Google Analytics, Search Console, and more. For basic informational blogs / sites, without eCommerce and advanced tracking needs, this plugin will likely do everything you want.

The Pros: The plugin can connect your site to Analytics, even if you’ve never used analytics or set up an Analytics account / property. It captures tracking for the most common things, and is ideal for the absolute beginner and those who don’t need advanced tracking.

The Cons: Looking for eCommerce visibility and advanced tracking of specific events? This plugin is probably not for you. You can add your own tracking for events if you want, but other plugins will do this all for you.

Overall: This plugin is ideally suited for small blogs and informational sites that don’t have huge tracking needs, and also for people just getting started with Analytics (it does all the work for you in the setup).

Option 2: SEO Plugins (SEOPress / Yoast / more)

Many SEO plugins will integrate with Analytics and provide basic tracking; SEOPress and Yoast both have options to integrate more deeply and provide tracking information on eCommerce and things like newsletter signups.

The Pros: These plugins give you a bit deeper integration / access than SiteKit as many of them – especially in their Pro or paid variants – will give you tracking on things like eCommerce and other common site events.

The Cons: From firsthand experience I can say that the integration these plugins offer is often a little weak. eCommerce integration doesn’t always work, and can outright fail if you’re using some caching systems.

Overall: Great for some sites, but test thoroughly to make sure that you’re not losing visibility on anything. Great for informational sites that don’t have advanced tracking / marketing needs.

Option 3: Analytics Plugins (e.g. Analytify)

Freemium plugin Analytify has stunning features, especially in it’s paid additions, which give it brilliant eCommerce functionality and great integration regardless of the caching plugin you’re using.

The Pros: This plugin has a free option which does the trick for your informational sites and blogs, provides great analytics / visibility on your eCommerce happenings in its paid offerings, and has a beautiful WordPress dashboard.

The Cons: Some of the tracking is a bit irritating in how it’s named. For example, “Add to Cart” tracking shows up on your analytics as “Enhanced eCommerce” and a purchase shows up as “Analytify Woo” – but it’s got the information needed for Analytics itself to sort out and display properly. It’s just… weird when you’re looking at the meat of the information. Their documentation is a bit lacking on that front as well.

Overall: Honestly, this is the plugin I use. It’s got the deeper integration I wanted, and I’ve had very little cause to do any manual event tracking with it. The price of the paid add-ons is reasonable for what they provide, and – despite the cryptic naming of event categories – it’s got what anyone from an info-blogger to an eCommerce store owner requires.

Option 4: Manual Tag Insertion

Rocking it old school, eh? Well, good for you! Unfortunately this means you’ll end up having to create a LOT of events yourself to get good visibility on them, but you’re not being held back by plugin bloat. I commend your dedication to a lightweight site. If you’re going to do this, please do not just drop the code into your theme – unless you know exactly what you’re doing and are using a child theme. Your theme likely has a “code” section in the Customizer, or in the Theme Settings area, where you can put tracking codes to be put in the “Head” section of your code right before your opening body tag. That’s where this should go.

The Pros: No plugin to install. Can’t get more lightweight than that! You can also dictate exactly how you’d like events to show up. Woo! Customizability!

The Cons: You have to do all of it yourself; from inserting the gtag script to connect Google Analytics, to creating the events you want to track.

Overall: This is probably not for everyone. I know there are people who do it, I just don’t know what the reasoning for it is when there’s so many good systems out there that’ll help you do it.


There’s a lot of options out there for adding analytics to your site. Depending on what you’re looking to achieve with your site and your analytics, you may find one option works better for you than the other.

Find this helpful? Got any questions? Did we miss something important? Let us know.

Posted in ,

Allen Pooley

Allen is a self professed geek and technology lover. He's always playing with one of his various websites, and loves helping customers with theirs. He can often be found with a coffee (light roast, please) in his hand and a smile on his face... or trapped under a pile of yarn.

About Websavers

Websavers provides web services like Canadian WordPress Hosting and VPS Hosting to customers all over the globe, from hometown Halifax, CA to Auckland, NZ.

If this article helped you, our web services surely will as well! We might just be the perfect fit for you.

Leave a Comment