Esta página aún no está traducida al español, así que la mostramos en inglés.

Google Tag Snippet Generator — gtag.js, GA4, Google Ads and Tag Manager

Enter your GA4 measurement ID, Google Ads ID or Tag Manager container ID and get install code that is ready to paste — with Consent Mode v2 defaults, cross-domain linking, debug mode, manual page views and cookie settings switched on only when you need them.

Actualizado el

In the <head>, as high as possible

Right after the opening <body> tag

In Webflow paste the head code in Site settings → Custom code → Head code. Using the cookie banner generator? Put its first snippet above this one.

Tus datos nunca salen de tu ordenador. Todo se procesa localmente en tu navegador.

Cómo usar: Google Tag Snippet Generator

  1. Choose Google tag to install GA4 or Google Ads directly, or Tag Manager if you manage tags in a GTM container.
  2. Enter your IDs — find the GA4 one in Admin → Data streams, and the container ID at the top of Tag Manager.
  3. Keep Consent Mode v2 defaults on if you show a cookie banner, and add only the options you need.
  4. Paste the head code into every page (Webflow: Site settings → Custom code), publish, and check the Realtime or DebugView report.

What each option adds

  • Consent Mode v2 defaults — gtag('consent', 'default', …) sets ad_storage, ad_user_data, ad_personalization and analytics_storage to denied before any tag runs, with wait_for_update so a banner has time to load. Your banner then calls gtag('consent', 'update', …).
  • Debug mode — debug_mode: true sends events to DebugView in GA4. Turn it off before you go live, or the debug traffic is mixed into reports for a few minutes at a time.
  • Manual page views — send_page_view: false stops the automatic page view, for single-page apps that send page_view on every route change.
  • Cross-domain tracking — linker.domains adds the _gl parameter to links between your domains, so one visit across them stays one session. You also need the domains listed in the GA4 data stream settings.
  • User ID — user_id joins one person’s visits across devices. It must be your own internal ID; Google’s policies forbid sending emails, names or other personal data.

Google tag or Tag Manager?

The Google tag (gtag.js) is the shortest way to add GA4 or Ads to a site. Tag Manager loads a container you edit in its web interface, so marketers can add tags, triggers and pixels without touching the code — the better choice when a site has many tags. Use one or the other for the same GA4 property, not both, or every page view is counted twice. Then send events with the GA4 Event Code Generator and check that tags load with the Tracking Tag Checker.

También se busca como: gtag snippet generator, google tag code generator, ga4 install code, gtag.js code, google tag manager snippet, gtm install code, google ads conversion tag, consent mode default code.

Herramientas que combinan con: Google Tag Snippet Generator

  • Event Tracking Script Generator — Track button clicks, links and form submits by adding attributes instead of code: data-track="sign_up_click" plus optional data-track-* parameters.
  • Cookie Consent Banner Generator — Add a cookie consent banner to any site — Webflow, WordPress, Shopify or plain HTML — without a paid plugin.
  • UTM Builder — Add utm_source, utm_medium, utm_campaign and friends to any link, see which GA4 channel the visit will land in, and tag a whole list of URLs at once.
  • GA4 Request Decoder — Debug Google Analytics 4 without guesswork.

Preguntas frecuentes

Where do I find my GA4 measurement ID?
In Google Analytics go to Admin → Data streams, open your web stream and copy the ID that starts with G-.
Can I install both GTM and gtag.js?
You can, but don’t load the same GA4 property in both, or page views are counted twice. If you use Tag Manager, add GA4 inside the container instead.
Does this code respect cookie consent?
With Consent Mode v2 defaults on, Google tags store no cookies until your banner sends a consent update. Without a banner that sends updates, Analytics stays in cookieless mode.
How do I check the tag works?
Turn on debug mode and open Admin → DebugView in GA4, or watch the Realtime report. The Google Tag Assistant browser extension shows every tag a page loads.
¿Puedo instalar Google Tag Snippet Generator como aplicación web y utilizarla sin conexión?
Sí. Google Tag Snippet Generator es una aplicación web instalable (PWA): se instala desde el navegador, no se descarga desde una tienda de aplicaciones. Haz clic en «Instalar aplicación» en la parte superior de esta página en Chrome o Edge (Windows, macOS, Linux, ChromeOS) o, en Android, utiliza «Compartir» → «Añadir a la pantalla de inicio» en iPhone y iPad, o «Archivo» → «Añadir al Dock» en Safari 17+ en un Mac. A continuación, se abrirá en su propia ventana con su propio icono y, como se ejecuta íntegramente en tu navegador, seguirá funcionando sin conexión. Firefox en el ordenador de sobremesa no permite instalar aplicaciones web. Cómo funciona la instalación.

Herramientas relacionadas