What GA4 Is and Why Track Traffic
If you want to add Google Analytics to WordPress, the version you are adding today is Google Analytics 4, usually written as GA4. It is the current generation of Google's free website measurement tool, and it replaced the older Universal Analytics that many site owners grew up with. GA4 counts your visitors, records the pages they view, follows the actions they take, and reports where they came from. All of that data lands in a dashboard you can open any time to see how your WordPress site is really performing.
The older Universal Analytics was built around sessions and pageviews. GA4 is built around events. In practice that means almost everything a visitor does is recorded as an event, whether it is a page view, a scroll, an outbound click, a file download, or a form submission. This event model is more flexible, and it is the same model that powers reporting across websites and apps. You do not need to master the theory to get value from it. You mostly need it installed correctly and firing on every page.
Why tracking WordPress traffic matters
A WordPress site without analytics is a shop with the lights off. You can guess what customers do, but you cannot see it. Once GA4 is running, you can answer questions that change how you spend your time and budget:
- Which pages bring people in. You learn which blog posts and landing pages earn the most visits, so you can write more of what works.
- Where visitors come from. Search, social, email, referral links, and paid ads each show up as a channel, so you can see what is pulling its weight.
- What people do next. You can watch how visitors move from a homepage to a service page to a contact form, and where they drop off.
- Which content leads to enquiries. With a little setup, GA4 can record a contact form submission or a phone tap as a conversion, tying traffic to real business results.
For a Canadian business trying to grow through its website, that visibility is the whole point. You stop arguing about opinions and start reading behaviour. If you would rather have a developer set this up correctly the first time, you can get a free quote and we will handle the whole install and verification.
The metrics you will actually use
GA4 reports a lot of numbers, and it is easy to feel buried at first. In truth, most WordPress owners live inside a handful of metrics. Users tells you how many people visited. Sessions counts their visits. Engaged sessions and engagement rate show how many of those visits involved real attention rather than an instant bounce. Views tells you how often pages were seen. Conversions counts the actions you have marked as important, such as a contact form submission. Start with those, get comfortable, and add depth later. You do not need every report to make better decisions, you need the few that map to your goals.
A quick word on how GA4 differs day to day
People coming from the old Universal Analytics sometimes expect a bounce rate front and centre or a familiar behaviour flow. GA4 arranges things differently, and its default reports lean on engagement rather than bounce. This is not a problem to solve, just a change to get used to. Once the tracking is in place, spend twenty minutes clicking through the Reports section so the layout feels familiar. The sooner GA4 feels like a normal part of your week, the sooner it starts paying you back.
The diagram above shows the basic mechanism. When a visitor opens a page, WordPress loads the small gtag.js snippet, that snippet sends a page_view event to Google, and GA4 records it. Every method in this guide is really just a different way of getting that snippet onto every page of your site. Once you understand that, the three methods below stop feeling like competing products and start feeling like three routes to the same destination.
Create a GA4 Property and Get Your Measurement ID
Before you touch WordPress at all, you need a GA4 property and its Measurement ID. The Measurement ID is the short code that starts with the letter G followed by a string of characters, written as G-XXXXXXX. It is the address label that tells the tracking snippet which account to report to. Without the right ID, your snippet will load and do nothing useful, so this first step matters more than it looks.
Step by step to create the property
- Sign in to Google Analytics. Use the Google account you want to own the data. For a business, use a company account rather than a personal one, so the data does not walk out the door when someone leaves.
- Open the Admin area. Look for the gear icon, usually in the lower left of the screen.
- Create an account, then a property. An account is the top level container, and a property is the specific website you want to track. Give the property a clear name such as your domain.
- Set your reporting time zone and currency. Canadian businesses should pick their local time zone so that daily reports line up with the working day.
- Create a web data stream. Choose the Web option and enter your WordPress site address. This is the step that generates your Measurement ID.
When the data stream is created, GA4 shows you the Measurement ID in the top right of the stream details, in that G-XXXXXXX format. Copy it somewhere safe. You will paste it into WordPress in whichever method you choose. That single value is the thread that connects your website to your reports, so keep it handy for the rest of this guide.
A note on the enhanced measurement setting
When you create the web stream, GA4 turns on a feature called enhanced measurement by default. This automatically tracks common actions such as scrolls, outbound clicks, site search, and file downloads without any extra code. For most WordPress sites you can leave it on and enjoy the extra data. If you ever see events you did not expect, enhanced measurement is often the reason, and you can adjust it from the same data stream settings screen.
One more habit worth forming early: keep your Measurement ID and your Google Tag Manager ID clearly labelled somewhere in your project notes. On a real build you may juggle a staging site and a live site, and mixing up two IDs is one of the most common ways analytics data ends up in the wrong place.
Give the data a day before you judge it
When a property is brand new, its reports look empty, and that is normal. Realtime shows visitors right away, but the standard reports take up to a day to fill in as GA4 processes the data. Do not panic on the first afternoon if the main reports look bare. Confirm the install with the Realtime report, then check back the next day when the fuller picture has caught up. Setting expectations here saves a lot of needless worry, especially for owners checking their numbers hourly in the first week.
Method 1: Add Google Analytics With a Plugin
The friendliest way to install Google Analytics on WordPress is a plugin. A plugin gives you a settings field, you paste your Measurement ID or your full snippet, you save, and the code is injected into every page for you. There is no theme editing and no risk of breaking a template. For most site owners, this is the method we suggest first.
Two families of plugin
There are two broad types of plugin that get the job done, and it helps to know the difference:
- Header and footer code plugins. These do one simple job. They give you a box for the head section and a box for the footer, and they output whatever you paste there on every page. You paste the gtag.js snippet into the header box and you are done. This family is light, predictable, and does not lock you in. The popular insert headers and footers style plugins fall into this group.
- Dedicated analytics plugins. These connect to your Google account, often ask only for the Measurement ID or a sign in, and then add reporting dashboards inside WordPress, plus extras such as event tracking toggles and consent features. They do more, at the cost of being heavier and adding their own settings to learn.
How to install with a header and footer plugin
- In your WordPress dashboard, go to Plugins, then Add New.
- Search for a headers and footers code plugin, install it, and activate it.
- Open its settings, usually under Settings or Tools.
- Paste your full gtag.js snippet into the header box. That snippet looks like this, with your own ID in place of the placeholder:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
</script>
Save, then load your website in a normal browser tab. The snippet is now on every page. The beauty of this approach is that it survives theme updates, because the code lives in the plugin and not in a theme file. If you switch themes next year, your tracking keeps working without a second thought.
Some header and footer plugins also let you paste only the Measurement ID into a dedicated field rather than the whole snippet. Both approaches reach the same result. Pasting the full snippet gives you more control if you later want to add a config option, while the ID only field is the quickest for a plain install. Either way, keep just one plugin doing this job. Stacking two plugins that both output analytics is a fast route to double counted traffic.
How to install with a dedicated analytics plugin
A dedicated plugin usually walks you through a short setup wizard. You install it, click a connect or authenticate button, sign in to your Google account, and pick the property you created earlier. Some let you simply paste the Measurement ID instead of signing in, which is handy when a client does not want to grant account access. After that, the plugin adds the tracking code for you and often shows a traffic summary right inside WordPress.
When a plugin is the right call
Choose the plugin route when you want the simplest possible install, when you are not comfortable editing code, or when you want reporting inside WordPress so you do not have to open Google Analytics as often. It is the method most small business owners are happiest with. If you later outgrow it, moving to a manual snippet or Tag Manager is straightforward. Our team often starts clients on a lightweight header plugin and only moves them to Tag Manager once their marketing needs grow. You can read more about keeping plugins lean and fast in our guide on how to speed up a WordPress website.
Method 2: Add the gtag.js Snippet Manually
The manual method means placing the gtag.js snippet directly into your site's code rather than letting a plugin do it. Some developers prefer this because it removes a plugin from the stack and gives full control over exactly where and how the code loads. It is the classic answer to the search for WordPress analytics without a plugin. Done carefully, it is clean and fast. Done carelessly, it disappears the next time your theme updates, so read the child theme note below before you start.
Option A: edit the theme header
Google's snippet is designed to load high in the head section of your pages. In a WordPress theme, the head is generated by a file called header.php. You can open that file and paste the snippet just before the closing head tag. Here is the same snippet again for reference:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
</script>
This works, but there is a serious catch. If you edit header.php directly in your active theme and the theme releases an update, your change is overwritten and your tracking vanishes without warning. That is why the next point is not optional advice, it is the difference between a stable install and a mystery outage.
Why a child theme matters for header edits
A child theme is a small companion theme that inherits everything from your main theme but holds your own changes safely. When you edit template files inside a child theme, a parent theme update can no longer wipe your work, because your files live in a separate folder. If you are going to touch header.php or any other template file by hand, do it in a child theme. This single habit prevents one of the most frustrating problems we see, where analytics silently stops after a routine update and nobody notices for weeks.
To use a child theme for this, you copy the parent header.php into your child theme folder, then add the snippet there. Your child version now loads instead of the parent version, and it stays put through updates. If your site does not have a child theme yet, creating one is a small job, and it pays off every time you need a template tweak.
Option B: use the functions file with a hook
A cleaner manual approach avoids editing header.php at all. Instead you add a small function to your child theme functions.php and hook it into wp_head, which is the action WordPress fires inside the head of every page. This keeps your snippet out of template markup and makes it easy to remove later. Here is a compact example:
function wpdev_add_ga4_head() { ?>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
</script>
<?php }
add_action('wp_head', 'wpdev_add_ga4_head', 1);
The number 1 at the end sets the priority so the code loads early in the head, which is where Google wants it. Because this lives in your child theme, it is safe from parent updates, and because it uses a hook, it works even with themes that do not expose a header.php you can easily edit.
Option C: a code snippets plugin
If you like the control of the functions approach but do not want to touch theme files at all, a code snippets plugin is a tidy middle ground. These plugins let you save small pieces of PHP or HTML that run on your site, managed from a single screen, with the ability to turn each one on or off. You paste the same wp_head function into a new snippet, activate it, and you are done. It gives you code level control with a plugin level safety net, and it keeps your tracking independent of the theme entirely. Many developers, ourselves included, reach for this on client sites because it makes handover and future edits clean.
Whichever manual option you choose, the goal is identical: get the gtag.js snippet loading in the head of every page, and make sure it cannot be erased by an update. If that sounds like more moving parts than you want to manage, this is exactly the kind of task worth handing to a developer. You can get a free quote and we will install it in a child theme so it stays reliable for years.
Method 3: Google Tag Manager
Google Tag Manager, or GTM, is a free tool that sits between your website and your tracking tools. Instead of pasting an analytics snippet, an ads pixel, and a chat script all separately into WordPress, you install one GTM container, and then you manage every tag from inside Tag Manager without touching your site code again. For a growing marketing operation, that central control is the reason to bother. For a simple brochure site, it can be more than you need.
How the pieces fit together
Tag Manager has three ideas worth knowing:
- Container. A single piece of code you add to your site once. It has an ID in the format GTM-XXXXXXX. Everything else lives inside it.
- Tags. The individual tools you want to run, such as your GA4 configuration, a conversion pixel, or a remarketing tag. You add each as a tag inside the container.
- Triggers. The rules that decide when a tag fires, such as on every page, on a button click, or on a form submission.
Setting up GA4 through GTM
- Create a free Tag Manager account and a container for your website. Tag Manager gives you two snippets, one for the head and one for the body.
- Add both snippets to WordPress. You can use the same header and footer plugin from Method 1, pasting the head snippet in the header box and the body snippet in the footer box. The head snippet looks like this:
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->
- Inside Tag Manager, create a new tag of the Google Analytics GA4 configuration type.
- Enter your Measurement ID, the same G-XXXXXXX value from earlier.
- Set the trigger to All Pages so it fires everywhere.
- Use the Preview mode to check it fires, then click Submit and Publish to make it live.
When Tag Manager is worth it
Reach for GTM when you run several marketing tools, when you want to add and change tracking without a developer each time, or when you need detailed event tracking such as clicks on specific buttons and form submissions. Marketers love it because they can manage everything themselves once it is set up. The trade off is a steeper start. You are learning a second tool on top of GA4, and a misconfigured container can double count your traffic, which we cover in the mistakes section. If your needs are simple today but you expect to grow, a common plan is to start with a plugin and move to Tag Manager later. Our team can set up a clean container structure so your marketing tags stay organised as you add more. Explore what that looks like on our services page.
Plugin vs Manual vs Tag Manager Compared
All three methods get GA4 tracking onto your WordPress site, and all three feed the same reports. The right choice depends on your comfort with code, how many tools you plan to run, and who will maintain the site. The table below lays out the trade offs side by side so you can match a method to your situation.
| Factor | Plugin | Manual snippet | Tag Manager |
|---|---|---|---|
| Setup difficulty | Easiest, paste and save | Medium, needs a child theme | Higher, learn a second tool |
| Code editing required | None | Yes, PHP or HTML | Container code once, then none |
| Survives theme updates | Yes, code lives in the plugin | Only if done in a child theme | Yes, code lives in the plugin or child theme |
| Adding more marketing tags | Limited, one at a time | Manual for each | Strong, all managed in one place |
| Reporting inside WordPress | Yes, with a dedicated plugin | No | No |
| Performance footprint | Small to medium | Smallest | Medium, extra container loads |
| Best for | Small business owners | Developers who want control | Active marketing teams |
A simple way to decide
- You want the least fuss: use a plugin. It is the fastest path and it is easy to change later.
- You are comfortable with code and want one less plugin: use the manual method inside a child theme.
- You run ads, pixels, and several tools: use Tag Manager for central control.
There is no single correct answer for every site. A local service business with a blog is well served by a plugin. An online store running paid campaigns across several networks will get more from Tag Manager. If you are unsure which fits your goals, that is a good thing to talk through before you build, and you can get a free quote to get a straight recommendation for your site.
How to Verify Google Analytics Is Working
Installing the code is only half the job. You then need to confirm data is actually flowing, because a snippet that looks right can still fail for small reasons, such as a caching plugin serving an old page or a typo in the Measurement ID. Verifying takes a few minutes and saves you from making decisions on empty or wrong data. Here are the reliable ways to check.
The Realtime report
The quickest test lives inside GA4 itself. Open your property and go to the Realtime report. Now open your own website in another browser tab and click around a few pages. Within a short time you should see yourself appear as an active user in Realtime, with the pages you visit showing up. If you see activity, the snippet is loading and reporting. If you see nothing after a few minutes, the code is not firing, and it is time to check the install.
Google Tag Assistant
Tag Assistant is Google's own tool for checking that tags are present and firing on a page. It connects to your site and lists the Google tags it finds, telling you whether your GA4 tag and, if you use it, your Tag Manager container are detected. It is especially useful when you are not sure whether a plugin is really outputting the snippet or whether an old tag is lingering from a previous setup. You can learn about the official Google tools and documentation at the Google tag platform site.
DebugView
DebugView is a screen inside GA4 that shows events as they happen for a single debug session, in fine detail. It is the best way to confirm that specific events, such as a form submission or a button click, are being recorded correctly. To send your activity to DebugView, you enable debug mode. With the manual snippet you can add a debug flag to your config line like this:
gtag('config', 'G-XXXXXXX', { 'debug_mode': true });
With Tag Manager, using Preview mode automatically routes your session into DebugView. Once debug mode is on, open DebugView in GA4 and interact with your site. You will see each event stream in as it fires, which makes it easy to confirm that your setup captures exactly what you intended. Remember to remove the debug flag from live code when you are finished testing, so real visitors are not all treated as debug traffic.
Check the page source directly
There is one more low tech check that settles most arguments. Load your live site, right click, and choose the option to view page source, then use your browser find function to search for your Measurement ID, the G-XXXXXXX value. If it appears in the head of the page, the snippet is present. If it appears more than once, you likely have a double tracking problem to fix, which we cover in the next section. If it does not appear at all, the code is not being output, so revisit your install method. This raw check cuts through caching confusion and browser extensions, because it shows you exactly what was sent to the browser.
A quick verification checklist
- See yourself in the Realtime report while browsing your own site.
- Confirm the tag is detected with Tag Assistant.
- Watch key events land in DebugView.
- Clear any caching plugin and test again, since caching can serve an old page without the snippet.
- Check on both a computer and a phone, since some themes load differently on mobile.
Once all of these pass, you can trust your reports. It is worth revisiting this checklist after any big change, such as a theme switch or a new caching setup, because those are the moments tracking most often breaks quietly.
Common Mistakes and Privacy for Canadian Sites
A working install can still produce misleading numbers if a few common mistakes creep in. Knowing them in advance saves you from cleaning up messy data later. Here are the ones we see most often on WordPress sites, followed by an important note on privacy for Canadian businesses.
Double tracking
Double tracking is when the same page view is counted twice, which inflates your numbers and quietly ruins your trust in the data. It usually happens when the GA4 snippet is added in two places at once. A classic example is loading GA4 through both a plugin and Tag Manager, or pasting the snippet into a header plugin while a theme option also outputs it. The fix is discipline: pick one method and one only. If you move from a plugin to Tag Manager, remove the plugin snippet first. When you audit a site, search for the Measurement ID in your source and make sure it appears once.
Not filtering your own traffic
Every time you and your team visit the site, you add to the visitor count, which skews the picture for a small business where staff visit often. You can reduce this by defining internal traffic in GA4 and filtering it out, so your reports reflect real customers rather than your own team testing pages. It is a small setup step that meaningfully improves data quality, especially in the early months when overall traffic is low and internal visits make up a large share.
Other frequent slips
- Wrong Measurement ID. Pasting a staging site ID onto the live site, or the reverse, sends data to the wrong property. Double check the G-XXXXXXX value.
- Caching hides the tag. A caching plugin can serve an older version of a page without the new snippet. Clear the cache after installing.
- Tracking blocked in testing. Ad blockers and privacy browser settings can block analytics, so a real visit may not show up while you test. Try a clean browser if Realtime looks empty.
- Forgetting mobile. Confirm the tag fires on phones, not just on your desktop.
Privacy and consent for Canadian sites
Analytics collects data about visitors, so it sits within privacy law. In Canada, the federal private sector privacy law is the Personal Information Protection and Electronic Documents Act, commonly called PIPEDA, and some provinces have their own comparable laws. The practical takeaway for a WordPress owner is straightforward, and none of it requires you to stop using analytics.
- Tell people what you collect. Keep a clear, current privacy policy that explains you use analytics and why. Transparency is the foundation of most privacy expectations.
- Consider a consent approach. Many Canadian sites, particularly those with visitors in other regions, use a consent banner so visitors can accept or decline non essential tracking. GA4 and Tag Manager both support consent settings that hold tracking until permission is given.
- Respect visitor choices. If someone declines, your setup should honour that rather than track anyway. Consent tools and privacy focused plugins help enforce this.
- Collect only what you need. Avoid capturing sensitive personal details in your event data. Analytics is meant to measure behaviour, not to build a file on individuals.
This is general guidance to help you set up responsibly, not legal advice. If your situation is sensitive or you serve visitors across many regions, confirm your obligations with a qualified professional. The good news is that GA4 can be configured to respect consent while still giving you the insight you need to grow.
A practical middle path suits most Canadian small businesses. Publish a plain language privacy policy, link to it in your footer, and add a consent banner if your audience or your comfort level calls for one. Then set your analytics to collect what helps you improve the site and nothing more. Handled this way, privacy and measurement are not in conflict. You get honest data about how people use your site, and your visitors get clarity about what happens when they arrive. That balance builds trust, and trust is good for business as well as good practice.
Putting it all together
Adding Google Analytics to WordPress comes down to three decisions: create your GA4 property and copy the Measurement ID, choose the install method that fits your comfort and goals, and verify that data is flowing before you rely on it. A plugin is the easy default, a manual snippet in a child theme gives developers control, and Tag Manager centralises tracking for busy marketing teams. Whichever you choose, keep your setup honest by avoiding double tracking, filtering your own visits, and respecting visitor privacy.
If you would rather skip the setup and start with clean, trustworthy data from day one, our team installs GA4 the reliable way, in a child theme or a tidy Tag Manager container, and verifies every event before handover. While we are in there, we also make sure your tracking does not slow the site, which pairs well with the advice in our guides on speeding up WordPress and securing your WordPress site. Ready to see what your visitors are really doing? Get a free quote and we will get your analytics working properly.