How do I add Google Analytics to my WordPress site?
To add Google Analytics to WordPress, you create a Google Analytics 4 property for your business at analytics.google.com, add a web data stream with your site's address, and put the Google tag from that stream on every page of your site. The data stream is where Google gives you a Measurement ID, which starts with "G-", and the tag is a short piece of code that loads Google's script with that ID. Every page that carries the tag sends Google a page view when someone opens it.
WordPress gives you three places to put the tag:
- Site Kit by Google. This is Google's own free plugin. You sign in with your Google account, pick or create your Analytics property, and Site Kit places the tag on every page for you. It also shows a small Analytics dashboard inside your WordPress admin.
- A header code plugin. Plugins such as WPCode give you a box for code that goes in the head of every page. You paste the Google tag there, and it survives theme changes. This is the better route when you also need to add your own event code, such as the form tracking described below.
- Your theme's files. You can paste the tag into your theme's header.php file. Unless you're using a child theme, the next theme update replaces that file and your tracking quietly stops.
If your site runs on WordPress.com rather than your own hosting, Google Analytics is a built-in setting on its paid plans from Premium up, where you paste your Measurement ID instead of the whole tag.
Installing the tag takes a few minutes. Getting it to record the right things takes longer, and it's where most setups go wrong. A tag can land twice when Site Kit and an older plugin both add it, which counts every page view twice. A caching plugin can keep serving the old copies of your pages without the tag until you clear the cache. A cookie banner can hold the tag back until a visitor accepts, so your test visit shows nothing. And Google's enhanced measurement, which tracks form interactions automatically, often misses forms that send without reloading the page. That's how many popular WordPress form plugins work, so the form fills you care about most never show up.
A good result is a tag that appears once on every page, an ID that matches the property you actually look at, a visit you can see arrive in the Realtime report, and a form fill that Google Analytics counts as a key event, which is what GA4 calls a conversion. Kite does that work for you. It checks what your site has now, writes the setup for your site, confirms it fires, and then turns the data into reports.
How to get started
Start by telling Kite in the chat in the Kite web app what you want measured:
"Set up Google Analytics on our WordPress site so we can see traffic and contact form fills."
Or, if tracking used to work and has stopped:
"Our Google Analytics stopped showing data last month. Find out why and fix it."
Kite is an AI marketer. It researches your business, builds a growth strategy, and ships the work that brings you new customers. Because it has already read your website, it knows your important pages, such as your contact page, your pricing page, and your booking form, so it can propose which actions count as conversions without a long brief. Confirm the list or change it, and Kite starts.
Connect your Google Analytics account through OAuth so Kite can read your properties, data streams, and reports. Use a Google account with Editor access to the property if you want Kite to change property settings or add custom dimensions. If you don't have a Google Analytics account yet, create one at analytics.google.com first, and Kite tells you which settings to choose as you go.
How Kite sets up Google Analytics on WordPress
What's on your site right now?
Kite starts by reading your live site, because what's actually on the pages matters more than what a plugin's settings screen says. It opens your home page, a blog post, and your contact page, renders them the way a browser would, and reads their code. It notes whether a Google tag is present, which ID it carries, whether it appears more than once, and whether the site loads Google Tag Manager instead. It also flags an old Universal Analytics ID starting with "UA-", since Google stopped processing that data in July 2023 and a tag carrying one records nothing.
This first check usually explains a "tracking keeps disappearing" problem on its own. A tag that's on the home page but missing from blog posts points to a page builder or a single-page code box. A tag that appears twice points to two plugins doing the same job.
Which property should the site report to?
Kite reads your Google Analytics account to match your site to the right place. It lists your accounts and properties, then the web data streams in each property, along with each stream's address and Measurement ID. It picks the stream whose address matches your domain and compares its ID with the one it found on your pages.
When the two don't match, your data is going somewhere you aren't looking, often to a property an old agency or a former employee set up. Kite tells you which property the site is sending to and which one you should use. It also checks the property's time zone and currency and corrects them if they're wrong, so a day in your reports starts at midnight where you are.
Writing the setup for your site
Kite writes the exact setup to paste in and chooses the route that suits your site. If nothing else is installed and you'd like a dashboard inside WordPress, it recommends Site Kit and lists which property and data stream to pick in Site Kit's setup screens. If you need form tracking or other custom code, it recommends a header code plugin and writes the full Google tag with your Measurement ID filled in. It points you away from theme files unless your site already uses a child theme.
For contact forms, Kite writes a short snippet that sends Google Analytics an event named generate_lead when your form plugin reports a successful send. Many form plugins announce a successful send in the page's code. Contact Form 7, for example, signals a sent message with its own event, which a snippet can listen for. If your form sends visitors to a thank-you page instead, Kite uses a view of that page as the signal, which needs no code at all. When two plugins are both adding the tag, the instructions say which one to remove.
Kite's WordPress connection works with posts and media, not with plugins or theme files, so installing the plugin or pasting the code is the one step you do yourself. The instructions are written for the WordPress screens you'll actually see.
Does the tag fire?
Kite confirms the tag works with real data, not just by finding it in the code. After you've installed it, Kite reads your pages again to check that the tag appears exactly once on each with the right ID. Then it asks you to open your site and send a test message through your contact form, and it runs a Realtime report on your property, grouped by event name and page, to see your visit arrive. A working setup shows page_view events within seconds, followed by generate_lead from the form.
When nothing arrives, Kite works through the usual causes in order:
- A caching plugin is still serving pages from before the install, so the cache needs clearing.
- A cookie banner is holding the tag back until a visitor accepts.
- An ad blocker in your own browser is stopping the request.
- An optimization plugin is delaying scripts until the visitor scrolls or clicks.
- The ID on the page belongs to a different property.
It tells you which one it found and what to change, then checks again.
Making form fills count as conversions
Kite reads the key events on your property to see whether a form fill already counts as a conversion. Marking an event as a key event happens in the Google Analytics interface, under Admin and then Events, so when generate_lead isn't marked yet, Kite tells you exactly which switch to turn on. A new event can take up to a day to appear in that list.
If your site has more than one form, such as a contact form and a quote request, Kite creates a custom dimension on the property for the form's name. That lets your reports show which form each lead came through, instead of one total for all of them.
Reporting on traffic and conversions
Once a week or so of data has built up, Kite reads it and tells you what it shows. It runs reports on sessions and active users by source and medium, so you see how many people came from Google search, from your ads, or from your emails. It reads key events by landing page, so you see which pages turn visitors into leads, and it compares each period with the one before so a change shows up as a number.
Kite posts the findings in the conversation where you asked, with a short explanation of what changed and what it would do next. If you want the same report every Monday, ask, and Kite runs it on that schedule and sends each one to the Kite web app, your email, or a Slack channel.
What the finished work contains
When Kite finishes, your WordPress site reports to the right Google Analytics property, the form fills you care about show up as conversions, and you have the evidence that it works.
- The Google tag on every page, once Your site carries one copy of the tag, with the Measurement ID of the property you actually use, installed through Site Kit or a header code plugin so a theme update can't remove it.
- Form tracking Each form fill sends a generate_lead event, or a thank-you page view stands in for it, and that event is marked as a key event in your property.
- A form-name dimension When you have more than one form, a custom dimension tells your reports which form each lead used.
- A record of the check The conversation shows which pages Kite read, the ID it found on each, and the Realtime report that showed your test visit and form fill arriving.
- Your first report Traffic by source and medium, key events by landing page, and the change from the previous period, with a schedule for the next one if you asked for it.
Common questions
Is Google Analytics free?
Yes. Google Analytics 4 is free for nearly every business, including all the setup on this page. Google also sells Google Analytics 360, a paid edition for large companies that need higher data limits and service agreements.
Can I see Google Analytics inside WordPress?
Yes, with Site Kit. Site Kit adds a dashboard to your WordPress admin with your traffic, top pages, and where visitors came from, pulled from your Google Analytics property. For anything deeper, such as conversions by landing page, you'll use Google Analytics itself or a report Kite writes for you.
Is there an API for Google Analytics?
Yes. Google offers a Data API for running reports and an Admin API for managing properties, data streams, and settings. Kite uses these through your connected account to read your reports and adjust your property, which is why it can check a setup and report on it without you exporting anything.
Do I need a cookie banner for Google Analytics?
If you have visitors in the European Union or the United Kingdom, you generally need their consent before Google Analytics sets cookies, which in practice means a consent banner. Your privacy policy should also say that you use Google Analytics. Keep in mind that visitors who decline won't appear in your reports, so your numbers will run lower than your real traffic.
Related pages
- Use caseImprove website conversion
- Use caseGet a weekly marketing report in Slack
- IntegrationGoogle Analytics + Kite
- IntegrationSelf-hosted WordPress + Kite
- How-toHow to connect Google Search Console to WordPressComing soon
- How-toHow to add a meta description in WordPress, and what to write in it
- How-toHow to add alt text to images in WordPress
- How-toHow to make a custom 404 page in WordPress that keeps visitors on your siteComing soon
- GuideThe best Google Analytics plugins for WordPress, including Site KitComing soon
- GuideA privacy policy for a WordPress site: what to put in it and how to add itComing soon



