domingo, 30 Ago 2026

Exclusive resources and tools for web design and development experts

Explore
BiblioWeb

Biblioweb.es

All About Web Technology

  • Start
  • Categories
    • Web Development and Plugins
    • AI & Web Automation
    • Cybersecurity and Web Security
    • WordPress Plugins
    • Web error solution
    • Web Hosting & Performance
  • WordPress
    • All about WordPress
    • WordPress Plugins
    • Web Development and Plugins
    • AI and Web Automation
    • WooCommerce
    • Hosting and Web Performance
    • Cybersecurity and Web Security
    • Web Error Resolution
    • Online Stores and Funnels
  • About Plugins
    • Yoast SEO
    • WooCommerce
    • Rank Math SEO
    • AI Engine
    • WP Rocket
    • WPCode
    • WP Translate Master
    • CartBounty
    • WP SEO Pro
  • Tools
    • Password Generator
    • QR Code Generator
    • Word Counter
    • JSON Formatter
    • Compresor de Vídeo para Web
    • Generador de Firmas de Email
    • Image to WebP Converter
    • Email Checker
  • Plugins Library
  • Español
  • English ✓
  • 🇨🇳 中文(简体)
  • Français
  • Deutsch
  • Italiano
History
  • WordPress
  • WordPress plugins
  • Create website
  • WooCommerce
  • WordPress tricks
  • See everything
BiblioWebBiblioWeb
Font ResizerAa
  • News History
Search
  • Start
  • Categories
    • Web Development and Plugins
    • AI & Web Automation
    • Cybersecurity and Web Security
    • WordPress Plugins
    • WooCommerce
    • Web Hosting & Performance
    • Troubleshooting web errors
    • Online Stores & Sales Funnels
  • WordPress
    • All about WordPress
    • WordPress Plugins
    • Web Development and Plugins
    • AI and Web Automation
    • WooCommerce
    • Hosting and Web Performance
    • Cybersecurity and Web Security
    • Web Error Resolution
    • Online Stores and Funnels
  • About Plugins
    • Rank Math SEO
    • AI Engine
    • WP Rocket
    • WPCode
    • WP Translate Master
    • CartBounty
    • WP SEO Pro
  • Blog
    • Español
    • English ✓
    • 🇨🇳 中文(简体)
    • Français
    • Deutsch
    • Italiano
  • My account
    • News History
  • Tools
    • Password Generator
    • QR Code Generator
    • Word Counter
    • JSON Formatter
    • Image to WebP Converter
    • Email Checker
    • Compresor de Vídeo para Web
    • Generador de Firmas de Email
Have an existing account? Sign In
Follow Us
© 2026 BiblioWeb — All rights reserved.
Cover » Blog » How to connect Google Analytics 4 to WordPress step by step
WordPress

How to connect Google Analytics 4 to WordPress step by step

Adrián Alcalá
Last updated: 08/08/2026 14:01
By Adrián Alcalá
Share
3 Min Read
WordPress - Goodbye to doubts Connect Google Analytics 4 to your WordPress and start growing (Guide to create a website for
Learn to connect Google Analytics 4 with your WordPress site step by step. Optimize your website, measure success, and make smart decisions. Start growing
SHARE

If you have a WordPress, you know how crucial it is to understand your visitors. Google Analytics 4 (GA4) is the free reference tool for this: it tells you how many people visit your website, where they come from, which pages they read, and at what point they leave. In this guide, we will connect Google Analytics 4 to WordPress step-by-step, with the three real methods you can use (Site Kit, Google Tag Manager, and manual code), verification that the data is actually arriving, and the legal notice you shouldn't skip if your audience is in Spain or the European Union.

Contents
What is a GA4 property and how to create itMethod 1: Connect Google Analytics 4 to WordPress with Site Kit (recommended)Method 2: Google Tag ManagerMethod 3: Insert the gtag code manuallyVerify that data is arriving: the real-time reportBasic events that GA4 measures automaticallyGDPR and consent: mandatory in SpainAnd with the data in hand, it's time to optimizeFrequently Asked Questions

What is a GA4 property and how to create it

Before touching anything in WordPress, you need a GA4 property. In Google Analytics, a property is the container that receives and processes your website's data. Each property has a Measurement ID with the format G-XXXXXXXXXX, and that identifier is what links your WordPress with Analytics.

To create it:

  1. Go to analytics.google.com with your Google account and click on Admin (the gear icon in the bottom left corner).
  2. Click Create > Property. Give it a recognizable name (e.g., your website's domain), select Spain as time zone and euro as currency.
  3. Complete the business details and, in the data collection step, choose Web.
  4. Enter your site's URL and a name for the data stream. When you save it, Google will show you the measurement ID G-XXXXXXXXXX.

Note down that ID: you will need it in any of the three following methods. Keep in mind that the old Universal Analytics version (IDs starting with UA-) stopped processing data in 2023, so today everything goes through GA4.

Method 1: Connect Google Analytics 4 to WordPress with Site Kit (recommended)

Site Kit by Google is the official Google plugin for WordPress and the easiest way if you don't want to touch code. In addition to Analytics, it integrates Search Console, AdSense, and PageSpeed Insights into your own WordPress dashboard.

  1. In your WordPress, go to Plugins > Add New y busca “Site Kit by Google”. Instálalo y actívalo.
  2. Click the button Start setup and log in with the same Google account where you created the GA4 property.
  3. Grant the permissions requested by the wizard and verify site ownership (Site Kit does this automatically).
  4. Inside Site Kit, go to Settings > Connect more services > Analytics, choose your account, your GA4 property, and your web data stream, and confirm.

Site Kit will insert the Google tag for you on all pages of the site, without duplicates and without you having to edit the theme. In 24-48 hours you will start to see summarized reports within WordPress itself, although the complete data will always be on analytics.google.com.

You Might Also Like

Cómo actualizar PHP en WordPress de forma segura
Payment gateways for WooCommerce: which ones to use and how to configure them
Your WordPress Under Attack: A Quick Guide for Beginners on How to Detect and Clean Your Site (Before It's Too Late).
How to create blog titles with AI for WordPress

Method 2: Google Tag Manager

If, in addition to Analytics, you are going to use advertising pixels (Meta, Google Ads), custom events, or heat map tools, it's worth using Google Tag Manager (GTM): a single container from which you manage all your tags without touching the website every time.

  1. Create an account and a web container in tagmanager.google.com. You will get an ID with the format GTM-XXXXXXX.
  2. Insert the container into WordPress with a plugin like GTM4WP or with a snippet manager. If you already use WPCode, you can paste the two snippets that GTM gives you (one in the <head> and another after the opening of the <body>) in a couple of snippets with the correct location.
  3. Inside GTM, create a tag of type Google Tag, paste your measurement ID G-XXXXXXXXXX and assign it the trigger All Pages.
  4. Use the Preview of GTM to check that the tag fires and, when everything works, click Submit to publish the container.

The advantage is clear: the next time you need to add another tag, you'll do it from GTM in two minutes, without installing more plugins or editing templates.

Method 3: Insert the gtag code manually

If you prefer not to rely on any analytics plugin, you can paste the global tag (gtag.js) directly into the <head> of your website. This is the official snippet, replacing G-XXXXXXXXXX with your measurement ID:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Where to paste it? The cleanest way is to use a snippet manager like WPCode, the snippet manager that has become essential in WordPress, creando un snippet de tipo HTML con ubicación “Site Wide Header”. Evita editar header.php of the theme directly: you would lose the code in the next theme update, unless you use a child theme. And very important: use only one method. If you install Site Kit and also paste the gtag manually, you will count each visit twice and your data will be inflated.

Verify that data is arriving: the real-time report

Connecting Google Analytics 4 to WordPress doesn't end when you save changes: you need to check that data is flowing. The fastest way:

  • Open your website in a browser incognito window (this avoids filters and session caches).
  • In GA4, go to Reports > Realtime. You should see at least 1 active user (you) within the next 30 seconds, along with the page you are visiting.
  • As an extra check, the Chrome extension Tag Assistant confirms which Google tags are loading on the page.

If real-time doesn't show anything, check three usual suspects: a cache plugin serving an old version of the page (purge the cache), an ad blocker in your own browser, or a wrongly copied measurement ID. Standard reports (Acquisition, Engagement, etc.) take 24 to 48 hours to populate, so don't be alarmed if they appear empty on the first day.

Basic events that GA4 measures automatically

Unlike the previous version, GA4 measures everything as events. With the enhanced measurement activated (it is by default in the web data stream), it will automatically record without any configuration:

  • page_view: each page view.
  • scroll: when the user reaches 90% of the page.
  • click: clicks to external domains.
  • file_download: PDF, ZIP, and other file downloads.
  • video_start and related: embedded YouTube video plays.
  • view_search_results: internal searches on your website.

When you want to measure something business-related (submitting a contact form, clicking a purchase button), you can create custom events from GTM or mark them as key conversions in GA4 without touching the website code.

GDPR and consent: mandatory in Spain

Google Analytics uses cookies, and in Spain the LSSI and GDPR require prior user consent before loading them. In practice, this means you need a real, not decorative, cookie banner: one that blocks the Analytics tag until the visitor accepts. Plugins like Complianz o CookieYes solve it well in WordPress and integrate the Google Consent Mode (Consent Mode v2), which adjusts tag behavior according to what the user has accepted. Complete the work with a published cookie policy and, in GA4, review Admin > Data Settings to adjust data retention (default 2 months; you can increase it to 14).

And with the data in hand, it's time to optimize

Once GA4 is connected, the interesting part begins: identifying your most visited pages, seeing which channels bring quality traffic, and detecting where navigation gets stuck. If you discover that users abandon due to slowness, we have a practical guide for speed up WordPress with PHP settings in 3 steps. And if you want that traffic to grow, combine analytics with good on-page SEO: we tell you how to install and configure Yoast SEO in WordPress.

Frequently Asked Questions

Is it complicated to connect Google Analytics 4 to WordPress?

No. With Site Kit by Google, the complete process takes less than 10 minutes and doesn't require touching code: you install the plugin, log in with your Google account, connect the Analytics service, and the plugin itself inserts the tag across the entire site. Methods with Google Tag Manager or manual gtag code require a bit more care, but are still affordable for any user following the steps in this guide.

What kind of data can I get with GA4?

GA4 records users, sessions, page views, acquisition channels (organic search, social media, direct traffic, campaigns), approximate demographic data, and events: outbound clicks, file downloads, scroll depth, video plays, and internal searches. You can also define key conversions (form submissions, purchases) and leverage funnel and user path reports to understand the complete journey within your website.

Can I use Google Analytics 4 without a cookie banner?

If your audience is in Spain or the EU, no. GA4 uses cookies and regulations require prior, informed, and revocable consent. The practical solution is a consent plugin (Complianz, CookieYes) that blocks Analytics until acceptance and implements Google's Consent Mode v2. The alternative would be a cookie-less analytics tool, but you would lose integration with the Google ecosystem.

TAGGED:GoodbyeAnalyticsConectadudasGoogleWordPress
Share This Article
Email Copy Link Print
ByAdrián Alcalá
Follow:
Adrián Alcalá es desarrollador WordPress y consultor SEO, autor del plugin WP Translate y creador de BiblioWeb. Desde aquí comparte guías, tutoriales y herramientas gratuitas para quienes crean, optimizan y posicionan páginas web. Lleva años ayudando a negocios de toda España a sacar el máximo partido a WordPress, y todo lo que publica está probado en proyectos reales.
Previous Article WordPress Security - Stop Hackers Your WordPress secured in minutes: Install and configure Wordfence like a pro (and forget How to install and configure Wordfence to protect WordPress
Next Article wordpress installation - WordPress Installation: What hosting do you need for TOP performance with AI? What hosting do you need for WordPress
como instalar wordpress - ¡Tu primera web en marcha! 🎉 Cómo instalar WordPress sin estrés y con la confianza de un experto (
¡Tu primera web en marcha! 🎉 Cómo instalar WordPress sin estrés y con la confianza de un experto (¡Te lo ponemos fácil!).
WordPress
como instalar wordpress - ¿Quieres saber cómo instalar WordPress como un PRO? 🚀 Guía definitiva para elegir el hosting perfe
¿Quieres saber cómo instalar WordPress como un PRO? 🚀 Guía definitiva para elegir el hosting perfecto (¡y que tu web vuele!)
WordPress
Best resources to learn WordPress
Los mejores recursos para aprender WordPress en español
WordPress
como instalar wordpress - ¡Adiós al miedo! Cómo instalar WordPress en tu propio servidor local (¡Perfecto para experimentar s
¡Adiós al miedo! Cómo instalar WordPress en tu propio servidor local (¡Perfecto para experimentar sin riesgos y crear tu #CrearPaginaWeb!)
WordPress
Advertisement

You May Also Like

Gutenberg block editor guide
WordPress

WordPress Block Editor Guide (Gutenberg)

08/08/2026
WordPress Trends 2026
WordPress

Tendencias WordPress 2026: lo que viene y cómo prepararte

24/08/2026
WordPress.com vs WordPress.org: comparison of the two platforms
WordPress

WordPress.com vs WordPress.org: differences and which to choose

08/08/2026
Update WordPress safely
WordPress

Cómo actualizar WordPress de forma segura (núcleo, tema y sin sustos)

24/08/2026
Show More
  • More News:
  • WordPress
  • Install
  • Guide
  • Create Web Page
  • how to install WordPress
  • Create
  • installation
  • future
  • Discover
  • Yoast
  • Plugins
  • tricks
  • WordPress installation
  • Goodbye
  • Runways
  • page
  • Create webpage
  • truco
  • Error
  • Construcción
BiblioWeb

Biblioweb.es

Web Technology News

Information you can trust: guías y soluciones prácticas de tecnología web — WordPress, plugins, ciberseguridad, hosting, rendimiento y solución de errores.

RSS

Enlaces de interés

  • About us
  • Contact
  • Free tools
  • Plugin Library

Subscribe now to receive real-time updates on the latest news!

Legal

  • Legal Notice
  • Terms and Conditions
  • Cookies Policy
  • Privacy Policy

Latest news

como instalar wordpress - ¡Tu primera web en marcha! 🎉 Cómo instalar WordPress sin estrés y con la confianza de un experto (

¡Tu primera web en marcha! 🎉 Cómo instalar WordPress sin estrés y con la confianza de un experto (¡Te lo ponemos fácil!).

25/08/2026
Continue reading
como instalar wordpress - ¿Quieres saber cómo instalar WordPress como un PRO? 🚀 Guía definitiva para elegir el hosting perfe

¿Quieres saber cómo instalar WordPress como un PRO? 🚀 Guía definitiva para elegir el hosting perfecto (¡y que tu web vuele!)

24/08/2026
Continue reading

© 2026 BiblioWeb — All rights reserved.

Gestionar consentimiento
Utilizamos tecnologías como las cookies para almacenar y/o acceder a la información del dispositivo. Lo hacemos para mejorar la experiencia de navegación y para mostrar anuncios (no) personalizados. El consentimiento a estas tecnologías nos permitirá procesar datos como el comportamiento de navegación o los ID's únicos en este sitio. No consentir o retirar el consentimiento, puede afectar negativamente a ciertas características y funciones.
Funcional Always active
El almacenamiento o acceso técnico es estrictamente necesario para el propósito legítimo de permitir el uso de un servicio específico explícitamente solicitado por el abonado o usuario, o con el único propósito de llevar a cabo la transmisión de una comunicación a través de una red de comunicaciones electrónicas.
Preferences
El almacenamiento o acceso técnico es necesario para la finalidad legítima de almacenar preferencias no solicitadas por el abonado o usuario.
Estadísticas
El almacenamiento o acceso técnico que es utilizado exclusivamente con fines estadísticos. El almacenamiento o acceso técnico que se utiliza exclusivamente con fines estadísticos anónimos. Sin un requerimiento, el cumplimiento voluntario por parte de tu proveedor de servicios de Internet, o los registros adicionales de un tercero, la información almacenada o recuperada sólo para este propósito no se puede utilizar para identificarte.
Marketing
El almacenamiento o acceso técnico es necesario para crear perfiles de usuario para enviar publicidad, o para rastrear al usuario en una web o en varias web con fines de marketing similares.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Ver preferencias
  • {title}
  • {title}
  • {title}
Welcome to Foxiz
Username or Email Address
Password

Lost your password?