Quick answer. The easiest way to add GA4 to WordPress is the free Site Kit by Google plugin: install it, connect your Google account, and it wires up Analytics for you, no code. If you'd rather paste the tag yourself, use a header-code plugin like WPCode to drop Google's gtag.js snippet into your site's head. Avoid using two methods at once or you'll double-count every visit.
Two methods, both free, both work. Pick one. Not both.
What you'll need
- A WordPress site you can log into as admin.
- A GA4 property and its Measurement ID (G-XXXXXXX). New to GA4? Start with the 10-minute setup capsule.
Add GA4 to WordPress
- Install Site Kit. In WordPress admin, go to Plugins, Add New and search Site Kit by Google. Install and activate it.
- Connect your account. Click Connect Google Account and sign in. Follow the prompts to set up Analytics and choose or create your GA4 property. Site Kit adds the tag for you.
- Or paste it yourself. Install WPCode instead, go to Code Snippets, Header and Footer, and paste your gtag.js snippet into the Header box. Save.
- Don't do both. One method only. Two tags double-count every visit.
Do it with AI
Want to add it by editing your theme instead of a plugin?
Add GA4 to my WordPress theme by hand
I want to add Google Analytics 4 to my WordPress site by editing code, not a plugin. My Measurement ID is G-XXXXXXX. Show me the safest way to add the gtag.js snippet to the <head> on every page using a child theme or a code snippet plugin, so it survives theme updates. Then tell me how to verify it.
How to check it worked
Open GA4, go to Reports, Realtime, then visit your site in another tab. You should appear as an active user within seconds. Site Kit also shows a status tick once connected.
Common mistakes
- Running multiple GA plugins. Site Kit AND a second GA plugin AND a hardcoded tag means every visit counts two or three times.
- Pasting the tag in the footer. The tag belongs in the head, not the body or footer.
- Installing an old UA plugin. Universal Analytics is dead. Your ID must start with G-, not UA-.
FAQ
- What's the easiest way to add GA4 to WordPress?
- The free Site Kit by Google plugin. Install, connect your Google account, and it sets up Analytics with no code.
- Do I need a paid plugin like MonsterInsights?
- No. Site Kit (free, official) or a free code plugin like WPCode both work. Paid plugins add reports inside WordPress, not better tracking.
- Will it slow my site down?
- The GA4 tag is lightweight and loads asynchronously. One tag is fine. Multiple overlapping tags are what cause bloat.
Tag's in. Now you still have to read it.
Holy Bucket reads your WordPress site's GA4 and tells you what's leaking, in plain English.