The Twenty Twenty-Five theme is a block-based, Full Site Editing (FSE) theme. Unlike older WordPress themes, it doesn’t use header.php
or footer.php
.
That raises a common question: “How do I install my Google Analytics 4 (GA4) tracking code if there’s no header.php file?”
Don’t worry there are multiple ways to add GA4 to Twenty Twenty-Five.
In this guide, we’ll walk you through three simple methods on How to Add Google Analytics 4 in the 2025 WordPress Theme:
1: Add GA4 with the Site Editor (Block Theme Method)
If you’re comfortable with WordPress’ Site Editor:
- Go to Appearance → Editor.
- Open Templates → Template Parts → Header.
- Switch to Code Editor mode (top right menu).
- Paste your GA4 snippet inside the
<head>
section.
Keep in mind: Not every block theme gives you direct <head>
access. If you don’t see it, use Method 2 or 3.
2: Add GA4 with Functions.php
The most reliable way is by using WordPress hooks. Twenty Twenty-Five doesn’t have header.php
, but WordPress still has the wp_head
hook.
You can add your GA4 snippet to it using a child theme or a custom plugin.
Paste this code into your child theme’s functions.php
:
Replace G-XXXXXXX
with your actual GA4 Measurement ID.
This ensures your GA4 code loads on every page without being affected by theme updates.
3: Use a Plugin (No Coding Required) [Recommended]
If you prefer not to touch code, plugins make this very easy. Two solid options:
- Insert Headers and Footers (simple, lightweight).
- Google Site Kit (official Google plugin with extra features like Search Console, PageSpeed Insights, etc.).
With these, you just paste your GA4 code in the plugin settings, and it loads site-wide.
Which Method Should You Choose?
- Beginner-friendly: Use a plugin.
- Future-proof and clean: Add it via
functions.php
in a child theme. - Quick edit: Use the Site Editor (if you’re comfortable with code).
So,
The Twenty Twenty-Five theme may not have header.php
, but adding Google Analytics 4 is still simple.
Whether you use the Site Editor, functions.php
, or a plugin, GA4 will start tracking your visitors and giving you the insights you need.
Video tutorial on How to Add Google Analytics 4 in the 2025 WordPress Theme – Coming Soon.
FAQs:
1. Can I just edit the Twenty Twenty-Five theme directly?
No. If you edit the parent theme, your changes will be lost when the theme updates. Always use a child theme or plugin.
2. Is Site Kit better than manually adding GA4?
Site Kit is easier and integrates more Google services, but if you only want GA4 tracking, manually adding the snippet is cleaner.
3. Do I need both GA4 and Universal Analytics?
No. Universal Analytics stopped working in July 2023. Use GA4 only.
Subscribe to Our Blog with your email (Is it too much too ask?);