With Site Kit (recommended)
- In WordPress, go to Plugins → Add New and search for Site Kit by Google.
- Install and activate it, then follow the setup and sign in with your Google account.
- Choose to set up Analytics and pick or create a GA4 property.
- Site Kit adds the tag to every page. You also get Search Console in the same dashboard.
With a header plugin
- In Google Analytics, open Admin → Data streams, pick your web stream and copy the Google tag.
- Install a plugin that adds code to the site header, and paste the tag there.
- Don’t also run Site Kit, or visits count twice.
Check that it works
Open your site in a private window, accept cookies and look at Realtime in Google Analytics.
The cookie banner
Google Analytics sets cookies, so EU visitors must accept first, and the ones who decline are missing. If you would rather skip the banner, see the best analytics for WordPress and the Okidoki WordPress guide.