Title: GAinWP Google Analytics Integration for WP
Author: tomdude
Published: <strong>14 Junho, 2018</strong>
Last modified: 29 Outubro, 2026

---

Procurar plugins

![](https://ps.w.org/ga-in/assets/banner-772x250.png?rev=3774061)

![](https://ps.w.org/ga-in/assets/icon-256x256.png?rev=3771767)

# GAinWP Google Analytics Integration for WP

 Por [tomdude](https://profiles.wordpress.org/tomdude/)

[Descarregar](https://downloads.wordpress.org/plugin/ga-in.6.1.0.zip)

 * [Detalhes](https://pt.wordpress.org/plugins/ga-in/#description)
 * [Avaliações](https://pt.wordpress.org/plugins/ga-in/#reviews)
 *  [Instalação](https://pt.wordpress.org/plugins/ga-in/#installation)
 * [Desenvolvimento](https://pt.wordpress.org/plugins/ga-in/#developers)

 [Suporte](https://wordpress.org/support/plugin/ga-in/)

## Descrição

GAinWP adds Google Analytics 4 (or a Google Tag Manager container) to your site 
and sends the events and dimensions that show what your site achieves, not just 
how many people visit. It uses GA4’s own event names, so results work in GA4 reports,
Google Ads and anything else that reads GA4. It has no dashboards or upsells, and
your data goes straight to Google.

#### Track results, not just traffic

 * **Form leads:** an event for every successful submission in Gravity Forms, Contact
   Form 7 and WPForms, whether the form uses AJAX, reloads the page or redirects
   to a thank-you page. Failed validation and spam don’t count. Set the forms that
   bring you business to Lead and they send GA4’s `generate_lead`; a sign-up form
   can send `sign_up`. Other forms send `form_complete`, so a newsletter or search
   form never counts as a lead. Field values are never sent.
 * **Goals with values:** mark the results that matter as goals and say what each
   is worth, for example $100 for a lead. Goals send their value to GA4 and, through
   it, Google Ads; per-form values override the default.
 * **WordPress events:** logins and registrations as GA4’s `login` and `sign_up`,
   and comments as `comment_submit`.
 * **Engagement events** that GA4 enhanced measurement doesn’t cover: email and 
   phone link clicks, affiliate link clicks (including `rel="sponsored"` links),
   same-page anchor clicks, and scroll depth at 25, 50 and 75%.

#### Page attributes

Sent with every event, under GA4-style names: content type and ID (built into GA4),
author, primary category (Yoast SEO and Rank Math’s primary category supported),
tags, publication month, content group, and whether the visitor is logged in.

#### GA4 setup checklist

A GA4 setup tab lists exactly what to do in Google Analytics for your settings: 
which custom dimensions to register, which events to mark as key events, and which
GA4 settings to change (currency, data retention, enhanced measurement, data redaction).
It also warns when Site Kit by Google adds the same tag or events, which would count
them twice.

#### Google Analytics 4 and Tag Manager

 * Paste your Measurement ID (G-XXXXXXXXXX), or your Tag Manager container ID.
 * In Tag Manager mode, page attributes go to the data layer (under their GA4 names
   and GAinWP 5.x’s `gainwp*` names) and events are pushed as `{ event, intelligence:{...}}`.
 * Cross-domain measurement, cookie domain and cookie lifetime settings, and an 
   optional AMP container for AMP plugin Reader mode pages.

#### Privacy

 * Google Consent Mode v2 defaults: leave them to your consent banner, deny in the
   EEA, UK and Switzerland only, or deny everywhere.
 * Optionally skip tracking for visitors who send Do Not Track or Global Privacy
   Control.
 * Visitor opt-out link or button with the `[gainwp_useroptout]` shortcode. A visitor’s
   opt-out is honored even if the site later turns the shortcode off.
 * No personal data in events: email addresses and phone numbers are removed from
   link text and URLs, and authors are sent by display name only.
 * Exclude logged-in user roles (and network super admins) from tracking. Post previews
   and the Customizer are never tracked.

> **Bug reports and feature requests:** [GAinWP on GitHub](https://github.com/levelten/ga-in).

### Upgrading from 6.0

 * **Form tracking starts on.** Successful submissions send `form_complete`, which
   nothing else sends, so leads your site already tracks another way aren’t counted
   twice. Set the forms that bring you business to Lead under Settings  Google Analytics
   Forms, and remove any other lead tracking for them. Logins, sign-ups and comments
   are off until you turn them on. A notice lists what’s new.
 * **Page attribute parameters have new names**, matching GA4’s style: `post_author`
   is now `content_author`, `post_category` is `content_category`, `post_tags` is`
   content_tags`, `publish_month` is `content_publish_month` and `user_type` is `
   user_status`. `publish_year` was removed: the month starts with the year. If 
   you registered the old names as custom dimensions, register the new ones (the
   GA4 setup tab lists them). Tag Manager’s `gainwp*` data layer names are unchanged.
 * Page attributes are now sent with `gtag('config')`, as Google recommends, and
   apply to every event.
 * The “Username” author format was removed; authors are sent by display name.
 * Scroll depth stops at 75%: GA4’s own scroll event covers 90%.
 * Engagement events now work in Tag Manager mode too.

### Upgrading from 5.x

Version 6.0 is a rewrite for Google Analytics 4. Google stopped processing Universal
Analytics data in July 2023, so 5.x has not been collecting anything since then.

**After updating, go to Settings  Google Analytics and enter your GA4 Measurement
ID.** Until you do, GAinWP adds no tag and shows a reminder on the Dashboard and
Plugins screens.

Carried over automatically:

 * Tracking method, including Tag Manager containers. Tag Manager sites keep working
   with no changes; data layer variable names are the same as before.
 * Custom dimension and data layer choices, which become page attributes.
 * Email, phone, anchor, affiliate and scroll tracking, Do Not Track, opt-out, excluded
   roles, cross-domain domains, cookie domain and lifetime.
 * Affiliate links are now matched by plain URL fragments such as `/out/` instead
   of a regular expression. Simple patterns convert automatically; if yours can’t,
   the settings screen tells you and affiliate events stay off until you update 
   it.

Removed:

 * Dashboard reports, real-time stats, post reports and the front-end widget. They
   relied on Google APIs that were shut down. Use Google Analytics, or Site Kit 
   by Google if you want reports in WordPress.
 * Download, outbound link and form submit events: GA4 enhanced measurement records
   these itself.
 * Google Optimize (discontinued by Google), Analytics on AMP pages, Universal Analytics
   ecommerce, sample rates, enhanced link attribution and the custom cookie name.
 * IP anonymization (GA4 never stores IP addresses) and the remarketing switch (
   manage Google signals in Google Analytics instead).
 * Custom event categories, actions and labels set with `data-vars-ga-*` attributes.
   GA4 has no categories or labels, so tracked links send the standard event names.
 * Your stored Google sign-in and cached report data are deleted.

Opt-outs recorded by 5.x are still honored.

### External services

GAinWP connects your site to Google so you can measure visits. It contacts no other
service.

 * **Google Analytics 4 mode** loads the Google tag (gtag.js) from googletagmanager.
   com on every page. The visitor’s browser then sends page views, the page attributes
   and events you enable, and standard browser data (such as page URL, referrer,
   screen size and language) to Google Analytics, under the Measurement ID you enter.
 * **Google Tag Manager mode** loads your container from googletagmanager.com on
   every page. What it sends, and to whom, depends on the tags you configure in 
   Tag Manager.

Nothing is sent to Google from your server, and nothing is sent before you enter
an ID. Events that happen on the server (a login, a form submission) are passed 
to the visitor’s browser in a short-lived first-party cookie, `gainwp_events_` followed
by random characters, which holds only the pending event and is deleted when the
event is sent or after a day. Visitors who opt out get a `gainwp_optout` cookie.
Google’s [Terms of Service](https://policies.google.com/terms), [Privacy Policy](https://policies.google.com/privacy)
and [Google Analytics Terms](https://marketingplatform.google.com/about/analytics/terms/us/)
apply.

## Ecrãs

[⌊Choose Google Analytics 4 or Google Tag Manager and paste your ID. The status 
line shows what GAinWP is sending.⌉⌊Choose Google Analytics 4 or Google Tag Manager
and paste your ID. The status line shows what GAinWP is sending.⌉[

Choose Google Analytics 4 or Google Tag Manager and paste your ID. The status line
shows what GAinWP is sending.

[⌊Goals: the results that matter on your site, each with a value in your currency.⌉⌊
Goals: the results that matter on your site, each with a value in your currency.⌉[

Goals: the results that matter on your site, each with a value in your currency.

[⌊Forms from Gravity Forms, Contact Form 7 and WPForms, each sending a lead, a sign-
up or another event, with an optional value of its own.⌉⌊Forms from Gravity Forms,
Contact Form 7 and WPForms, each sending a lead, a sign-up or another event, with
an optional value of its own.⌉[

Forms from Gravity Forms, Contact Form 7 and WPForms, each sending a lead, a sign-
up or another event, with an optional value of its own.

[⌊WordPress and engagement events, and the page attributes sent with every event.⌉⌊
WordPress and engagement events, and the page attributes sent with every event.⌉[

WordPress and engagement events, and the page attributes sent with every event.

[⌊The GA4 setup tab: the custom dimensions to register, the key events to mark and
the GA4 settings to check.⌉⌊The GA4 setup tab: the custom dimensions to register,
the key events to mark and the GA4 settings to check.⌉[

The GA4 setup tab: the custom dimensions to register, the key events to mark and
the GA4 settings to check.

[⌊Privacy settings (Consent Mode v2 defaults, Do Not Track and Global Privacy Control,
visitor opt-out) and role exclusions.⌉⌊Privacy settings (Consent Mode v2 defaults,
Do Not Track and Global Privacy Control, visitor opt-out) and role exclusions.⌉[

Privacy settings (Consent Mode v2 defaults, Do Not Track and Global Privacy Control,
visitor opt-out) and role exclusions.

## Instalação

 1. Install and activate GAinWP from Plugins  Add New.
 2. Go to Settings  Google Analytics.
 3. Choose Google Analytics 4 and enter your Measurement ID, or choose Google Tag Manager
    and enter your container ID.
 4. Save. Open your site in a private browser window and check Reports  Realtime in
    Google Analytics.

## Perguntas frequentes

### Where do I find my Measurement ID?

In Google Analytics, go to Admin  Data streams and open your web stream. The Measurement
ID starts with G-.

### Why don’t page attributes or form names show up in my reports?

GA4 only reports custom parameters you register. The GA4 setup tab under Settings
Google Analytics lists the ones your settings send, such as `content_author`, `content_category`
and `component_name`. In Google Analytics, go to Admin  Data display  Custom definitions
and create an event-scoped custom dimension for each. Content type, content ID and
content group are built into GA4.

### How do I count form submissions as conversions?

Under Settings  Google Analytics  Forms, set the forms that bring you business to
Lead (every form sends `form_complete` until you do). In Google Analytics, mark `
generate_lead` (and `sign_up`, if you use it) as a key event. Mark `generate_lead`,
not GA4’s own `form_submit`, which counts every submit attempt. Give leads a value
under Goals to see the value they bring in GA4 and Google Ads.

### Which form plugins are supported?

Gravity Forms, Contact Form 7 and WPForms (Lite and Pro). Contact Form 7 counts 
a submission once its email has been sent, which is when it reports success. Other
plugins and themes can send their own events with `gainwp.track()` or the PHP recorder(
see below).

### Does it work with cookie consent banners?

Yes. Most banner plugins set Google Consent Mode themselves, so leave “Consent mode
default” set to “Not set”. Choose a denied option only if your banner sends consent
updates but doesn’t set defaults.

### How do I check that it’s working?

View the source of any page while logged out and look for the `GAinWP` comment followed
by the Google tag. Settings  Google Analytics also shows what is being sent. Logged-
in users in excluded roles are not tracked, so test from a private browser window.

### Can I use it alongside Site Kit or another analytics plugin?

Use only one plugin to add the Google tag, or page views are counted twice. Site
Kit can show reports without adding the tag if you turn off its “Place Google Analytics
code” setting. If Site Kit’s plugin conversion tracking is on, also turn it off 
when GAinWP tracks your forms, or leads count twice. GAinWP warns you when it sees
either overlap.

### How can I customize the output?

Developers can use these hooks:

 * `gainwp_gtag_config` (filter): parameters of the `gtag('config')` command.
 * `gainwp_page_data` (filter): page attributes before they are sent, keyed by parameter
   name (`content_author`, …). Keys from 6.0 (`author`, …) are still mapped.
 * `gainwp_exclude_tracking` (filter): return true to skip tracking for the current
   request. For page output it runs after the query is parsed, so conditional tags
   such as `is_page()` work; it also runs when an event is recorded on the server,
   such as a login or form submission, with a second argument `'event'` (page output
   passes `'page'`).
 * `gainwp_event` (filter): change an event recorded on the server, or return null
   to drop it.
 * `gainwp_event_recorded` (action): runs when an event recorded on the server is
   queued, for example to react to a lead.
 * `gainwp_integrations` (filter): add or remove integrations (classes implementing`
   GAinWP\Integrations\Integration`, or `FormSource` for form plugins). An integration’s`
   ajax_events()` names the browser events, such as a form plugin’s success event,
   after which events recorded during an AJAX request are sent.
 * `gainwp_consent_regions` (filter): regions where consent defaults to denied.
 * `gainwp_scroll_thresholds` (filter): scroll depth percentages.
 * `gainwp_gtag_script_path` (filter): gtag.js URL, for example to use a proxy.
 * `gainwp_tagmanager_datalayer` (action): change data layer variables with the 
   tracker’s `get()` and `set()` methods.
 * gainwp_gtag_commands still runs but is deprecated in favor of `gainwp_gtag_config`.

To send your own events from JavaScript, call `gainwp.track( 'event_name', { parameter:'
value' } )`; it works in both tracking modes and honors opt-outs. From PHP, call`\
GAinWP\Plugin::instance()->recorder()->record( 'event_name', array( 'parameter' 
=> 'value' ) )`; the event is sent from the visitor’s browser on their next page
view, or right away after an AJAX submission in a supported form plugin.

## Avaliações

![](https://secure.gravatar.com/avatar/5cc0e8449b6cc9cd214a1415c8f1c18841a82d0e6afb5320656555c2fe0c2671?
s=60&d=retro&r=g)

### 󠀁[Was no longer working](https://wordpress.org/support/topic/was-no-longer-working/)󠁿

 [hamburg86](https://profiles.wordpress.org/hamburg86/) 19 Outubro, 2023

Was the best analytics plugin. Unfortunately not updated for 3 years. Accordingly,
it is suddenly no longer usable for me that anything is no longer supported. You
are supposed to create an account for this, but that is not possible. Have tested
a few other plugins, but you can forget them all, that just does not show the real,
real data. I hope and pray that the creators of the plugin fix or update this. I
have over 300 pages on my website, so I can't manually use Analytics everywhere 
as a layman. Please make the plugin available again.

![](https://secure.gravatar.com/avatar/3b4cfa16d59f54a7b677bd351ddb93c4e134c0c59c749862a77e3f91b5f57825?
s=60&d=retro&r=g)

### 󠀁[Stopped working due GA4](https://wordpress.org/support/topic/stopped-working-due-ga4/)󠁿

 [radwoc](https://profiles.wordpress.org/radwoc/) 13 Agosto, 2023

It was best GADWP replacement, but after years it is not supporting new GA4. Good
bye.

![](https://secure.gravatar.com/avatar/b09fc1320926878c253f82c4ae64175b2d811c46887387f5f9e58ddca08986b9?
s=60&d=retro&r=g)

### 󠀁[unfortunately no longer up to date.](https://wordpress.org/support/topic/unfortunately-no-longer-up-to-date/)󠁿

 [sebastianwartenberg](https://profiles.wordpress.org/sebastianwartenberg/) 22 Maio,
2023

It was the perfect plugin for years. Now no one cares anymore. Too bad, I have great
difficulty finding something equivalent.

![](https://secure.gravatar.com/avatar/aaafda5081b8a6aa15635ff9a4cbeb3c59946c4a99519a356d4d339972431ada?
s=60&d=retro&r=g)

### 󠀁[No longer maintained; no GA4 support](https://wordpress.org/support/topic/no-longer-maintained-no-ga4-support/)󠁿

 [Will Skora](https://profiles.wordpress.org/skorasaurus/) 26 Janeiro, 2023

I had been using since 2018ish and it worked great for years although the current
developer is no longer maintaining it and hasn't been updated since 2020 as of this
writing. It still currently works (early 2023) but there is no support for GA4 so
I'll be moving away from it very soon.

![](https://secure.gravatar.com/avatar/24e6ce434fd4171ae522cd22d710505c4ab1013a537376d4ce1dff45a7f2fae2?
s=60&d=retro&r=g)

### 󠀁[Good and simple plugin but seems abandoned](https://wordpress.org/support/topic/good-and-simple-plugin-but-seems-abandoned/)󠁿

 [Toine Rademacher](https://profiles.wordpress.org/toineenzo/) 30 Maio, 2022

I really like this plugin as it provides a simple Analytics viewer on the dashboard.
Unfortunately it hasn't been updated and I expect it to stop working when Google
Analytics 3 gets deprecated.

![](https://secure.gravatar.com/avatar/d1240bcdb1b04edb15eb0b6f34f7ad7d3c3e2cf3ac3c3413f2dde28443e96b82?
s=60&d=retro&r=g)

### 󠀁[Not supported anymore](https://wordpress.org/support/topic/not-supported-anymore-13/)󠁿

 [Morten Ellegaard Larsen](https://profiles.wordpress.org/ellegaarddk/) 29 Dezembro,
2021

Several errors with deprecated PHP, hasn't been any changes for too long. Not stable

 [ Ler todas as 125 avaliações ](https://wordpress.org/support/plugin/ga-in/reviews/)

## Contribuidores e programadores

“GAinWP Google Analytics Integration for WP” é software de código aberto. As seguintes
pessoas contribuíram para este plugin:

Contribuidores

 *   [ tomdude ](https://profiles.wordpress.org/tomdude/)

“GAinWP Google Analytics Integration for WP” foi traduzido para 10 locales. Obrigado
aos [tradutores](https://translate.wordpress.org/projects/wp-plugins/ga-in/contributors)
pelas suas contribuições.

[Traduza o “GAinWP Google Analytics Integration for WP” para o seu idioma.](https://translate.wordpress.org/projects/wp-plugins/ga-in)

### Interessado no desenvolvimento?

[Consulte o código](https://plugins.trac.wordpress.org/browser/ga-in/), consulte
o [repositório SVN](https://plugins.svn.wordpress.org/ga-in/), ou subscreva o [registo de alterações](https://plugins.trac.wordpress.org/log/ga-in/)
por [RSS](https://plugins.trac.wordpress.org/log/ga-in/?limit=100&mode=stop_on_copy&format=rss).

## Registo de alterações

#### 6.1.0

 * New: form tracking for Gravity Forms, Contact Form 7 and WPForms, on by default.
   Successful submissions send `form_complete`, or `generate_lead` or `sign_up` 
   for forms you set to Lead or Sign-up, with the form’s ID and name, including 
   AJAX forms and forms that redirect.
 * New: goals with values. Mark results as goals, give them a value and a currency,
   and set per-form values.
 * New: GA4’s `login` and `sign_up` events for WordPress logins and registrations,
   and `comment_submit` for comments.
 * New: GA4 setup tab listing the custom dimensions, key events and GA4 settings
   your configuration needs, with warnings when Site Kit adds the same tag or events.
 * New: page attributes for content type and ID, content group, and the primary 
   category from Yoast SEO or Rank Math.
 * New: `gainwp.track()` in JavaScript and a PHP recorder for sending your own events;`
   gainwp_event`, `gainwp_event_recorded` and `gainwp_integrations` hooks.
 * Changed: page attribute parameters renamed to GA4-style names (`content_author`,`
   content_category`, `content_tags`, `content_publish_month`, `user_status`); `
   publish_year` removed. See “Upgrading from 6.0”.
 * Changed: page attributes are sent with `gtag('config')` instead of `gtag('set')`,
   so they reliably apply to every event.
 * Changed: engagement events now work in Tag Manager mode, and links marked `rel
   ="sponsored"` count as affiliate links.
 * Changed: scroll depth stops at 75%; GA4’s enhanced measurement covers 90%.
 * Changed: authors are always sent by display name; the username option was removed.
 * Fixed: a visitor’s opt-out is honored even after the site turns the opt-out shortcode
   off.
 * Fixed: link click events no longer send the Universal Analytics `transport_type`
   parameter.

#### 6.0.0

 * Rewritten for Google Analytics 4 and modern WordPress (PHP 7.4+, WordPress 6.0
   +).
 * New: Google Consent Mode v2 defaults, Global Privacy Control support, scroll 
   depth for GA4, opt-out for Tag Manager sites.
 * Settings move to Settings  Google Analytics, with a status summary.
 * Settings from 5.x are migrated automatically. See “Upgrading from 5.x”.
 * Removed Universal Analytics, dashboard reports and real-time stats, Google sign-
   in, and features Google has discontinued.

#### 5.4.6

 * Last Universal Analytics release.

## Metadados

 *  Versão **6.1.0**
 *  Última actualização **Há 2 semanas**
 *  Instalações activas **7.000+**
 *  Versão do WordPress ** 6.0 ou superior **
 *  Testado até **7.1.4**
 *  Versão do PHP ** 7.4 ou superior **
 *  Idiomas
 * [Chinese (Taiwan)](https://tw.wordpress.org/plugins/ga-in/), [Dutch](https://nl.wordpress.org/plugins/ga-in/),
   [English (Australia)](https://en-au.wordpress.org/plugins/ga-in/), [English (US)](https://wordpress.org/plugins/ga-in/),
   [French (France)](https://fr.wordpress.org/plugins/ga-in/), [Japanese](https://ja.wordpress.org/plugins/ga-in/),
   [Portuguese (Brazil)](https://br.wordpress.org/plugins/ga-in/), [Russian](https://ru.wordpress.org/plugins/ga-in/),
   [Spanish (Argentina)](https://es-ar.wordpress.org/plugins/ga-in/), [Spanish (Chile)](https://cl.wordpress.org/plugins/ga-in/)
   e [Spanish (Spain)](https://es.wordpress.org/plugins/ga-in/).
 *  [Traduza para o seu idioma](https://translate.wordpress.org/projects/wp-plugins/ga-in)
 * Etiquetas
 * [analytics](https://pt.wordpress.org/plugins/tags/analytics/)[consent mode](https://pt.wordpress.org/plugins/tags/consent-mode/)
   [ga4](https://pt.wordpress.org/plugins/tags/ga4/)[google analytics](https://pt.wordpress.org/plugins/tags/google-analytics/)
   [google tag manager](https://pt.wordpress.org/plugins/tags/google-tag-manager/)
 *  [Visualização avançada](https://pt.wordpress.org/plugins/ga-in/advanced/)

## Classificações

 4.8 out of 5 stars.

 *  [  117 5-star reviews     ](https://wordpress.org/support/plugin/ga-in/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/ga-in/reviews/?filter=4)
 *  [  2 3-star reviews     ](https://wordpress.org/support/plugin/ga-in/reviews/?filter=3)
 *  [  5 2-star reviews     ](https://wordpress.org/support/plugin/ga-in/reviews/?filter=2)
 *  [  2 1-star reviews     ](https://wordpress.org/support/plugin/ga-in/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/ga-in/reviews/#new-post)

[Ver todas as revisões](https://wordpress.org/support/plugin/ga-in/reviews/)

## Contribuidores

 *   [ tomdude ](https://profiles.wordpress.org/tomdude/)

## Suporte

Tem algo a dizer? Precisa de ajuda?

 [Ver fórum de suporte](https://wordpress.org/support/plugin/ga-in/)