Title: WP Global Site Tag
Author: digitalapps
Published: <strong>15 Dicembre 2017</strong>
Last modified: 5 Settembre 2026

---

Ricerca i plugin

![](https://ps.w.org/wp-global-site-tag/assets/banner-772x250.png?rev=3644178)

![](https://ps.w.org/wp-global-site-tag/assets/icon-256x256.png?rev=3658052)

# WP Global Site Tag

 Di [digitalapps](https://profiles.wordpress.org/digitalapps/)

[Scarica](https://downloads.wordpress.org/plugin/wp-global-site-tag.2.0.3.zip)

 * [Dettagli](https://it.wordpress.org/plugins/wp-global-site-tag/#description)
 * [Recensioni](https://it.wordpress.org/plugins/wp-global-site-tag/#reviews)
 *  [Installazione](https://it.wordpress.org/plugins/wp-global-site-tag/#installation)
 * [Sviluppo](https://it.wordpress.org/plugins/wp-global-site-tag/#developers)

 [Supporto](https://wordpress.org/support/plugin/wp-global-site-tag/)

## Descrizione

[WP Global Site Tag](https://digitalapps.com/wordpress-plugins/wp-global-site-tag/)
provides two related tools without mixing their state:

 * Tracking installs a Google tag or Google Tag Manager container on the public 
   site.
 * Reporting connects an administrator to Google Analytics with read-only access
   and displays reports inside WordPress.

You can use either tool independently. Connecting Analytics never enables tracking
or silently replaces an existing tag.

#### Free features

 * Guided Google Analytics connection and property and website data-stream selection.
 * Analytics overview, daily traffic trend, and top-five content reports.
 * An inclusive last-7-days range, with one dated trend point per day. Free rejects
   longer ranges on the server.
 * Persistent managed Google connection, plus an advanced self-managed OAuth option.
 * Plugin-managed, externally managed, or disabled tag installation modes.
 * `GT-`, `G-`, `AW-`, and `DC-` identifiers through gtag.js.
 * Official Google Tag Manager head and body snippets for `GTM-` identifiers.
 * Existing legacy `UA-` tracking IDs remain visible and continue rendering, including
   when Google routes the installed tag to a connected GA4 destination.
 * Multiple Google tag destinations and optional Consent Mode v2 denied defaults.
 * Backward compatibility for existing trusted custom gtag commands.

#### Pro features

[WP Global Site Tag Pro](https://digitalapps.com/wordpress-plugins/wp-global-site-tag/?utm_source=wordpress&utm_medium=plugin&utm_campaign=wp_global_site_tag_pro&utm_content=readme_description)
is a separately installed add-on that extends the Free Analytics dashboard while
keeping tracking settings and the Google connection in Free.

 * Last 30 days, last 90 days, last 6 months, last 12 months, year-to-date, and 
   custom date ranges.
 * Period-over-period and previous-year comparisons.
 * Realtime active users, advanced totals, and selectable trend metrics.
 * Traffic acquisition, UTM campaign, country, and device reports with expanded 
   rows.
 * Protected CSV export for the current report.

Settings are available under **Settings > WP Global Site Tag**. The **Analytics 
dashboard** tab contains the recommended connection route. The **Tracking settings**
tab preserves the manual route.

#### Recommended Google connection

Click **Connect with Google**, choose an account, approve read-only Analytics access,
and return to WordPress to choose a property and website data stream. The recommended
connection uses the Digital Apps connection service so administrators do not need
to create a Google Cloud project or handle OAuth credentials.

Digital Apps exchanges the authorization code and retains the Google refresh token
while the connection is active. WordPress stores an encrypted opaque connection 
token and short-lived Google access tokens. The plugin then calls the Google Analytics
Admin and Data APIs directly, so Analytics property, stream, and report requests
and responses do not pass through Digital Apps.

Because Digital Apps retains the refresh token, it is technically able to request
Analytics access while the connection remains active. The advanced self-managed 
route below is available for administrators who do not accept that trust boundary.

Administrators who require no Digital Apps token custody can open **Advanced: use
your own Google OAuth application**. That route provides the Google Cloud instructions
and exact callback URL. Credentials may be saved encrypted or defined in `wp-config.
php` as `WP_GLOBAL_SITE_TAG_GOOGLE_CLIENT_ID` and `WP_GLOBAL_SITE_TAG_GOOGLE_CLIENT_SECRET`.
Constants take precedence.

After Google returns to WordPress, choose an Analytics property and its website 
data stream. The plugin recommends hostname and exact existing-Measurement-ID matches,
but an administrator confirms every selection.

#### Identifier guide

 * **Property ID** is the numeric GA4 reporting property used by the Data API.
 * **Data Stream ID** is the numeric identifier of one stream inside a property.
 * **Measurement ID** begins with `G-` and identifies the website tag for that stream.
 * **Google Tag Manager container ID** begins with `GTM-` and is a separate tracking
   integration.
 * A legacy **Universal Analytics tracking ID** begins with `UA-`. Version 2 preserves
   it as the frontend tag but does not use it as the GA4 reporting Measurement ID.

These values are stored separately. Choosing a reporting stream does not overwrite
the generic tracking ID unless the administrator explicitly chooses replacement 
after a mismatch warning.

#### Installation modes

 * **Install with WP Global Site Tag** lets this plugin output the saved tag.
 * **Tracking is installed elsewhere** keeps reporting available but prevents duplicate
   tag output.
 * **Do not install a tag** disables tag output while preserving the reporting connection.

#### Existing users

Version 2 preserves the existing option name, manual tag ID, additional destinations,
Consent Mode setting, trusted custom commands, hooks, and frontend behavior. This
includes legacy `UA-` identifiers that Google may route to a connected GA4 destination.
Existing sites default to plugin-managed installation so an update does not stop
measurement. Analytics reporting remains disconnected until an administrator completes
the new read-only connection.

#### Consent and privacy

Consent Mode is not a consent banner. You still need a consent management platform
or your own consent interface to collect a visitor’s choice and update Google’s 
consent state.

When Consent Mode defaults are enabled, this plugin still loads gtag.js. Google 
may receive consent-state and cookieless requests before consent is granted. If 
your requirements prohibit loading Google before consent, use the `wp_global_site_tag_should_render`
filter to prevent output until your consent system allows it.

When using a GTM container, configure consent initialization and defaults inside
Google Tag Manager. The plugin’s Consent Mode setting applies only to gtag.js output.

With the recommended connection, Digital Apps stores the Google refresh token and
WordPress stores an opaque connection token and short-lived access tokens. With 
the advanced self-managed connection, OAuth credentials and Google refresh and access
tokens stay on WordPress. Locally stored connection data is encrypted with keys 
derived from WordPress salts and saved in non-autoloaded options. Administrators
can disconnect at any time, which requests revocation and removes local connection
data and report caches. The saved frontend tag remains unchanged.

#### External services

When tracking is enabled, visitors’ browsers request Google tag resources from `
https://www.googletagmanager.com`. These requests disclose standard web request 
information such as the visitor’s IP address, browser details, and referring page
to Google. Configured Google products may send additional measurement or advertising
events.

The recommended connection sends the site URL, hostname, plugin and protocol versions,
callback URL, a short-lived state and code challenge, and later an opaque connection
token to `https://connect.digitalapps.com/v1/`. Digital Apps uses this information
only to complete Google authorization, retain the refresh token, renew short-lived
access, and revoke the connection. It does not receive Analytics property, stream,
or report requests or responses.

When an administrator views reports, the plugin communicates directly with these
Google services:

 * Google authorization at `accounts.google.com`.
 * Google Analytics Admin API at `analyticsadmin.googleapis.com`.
 * Google Analytics Data API at `analyticsdata.googleapis.com`.

The advanced self-managed route additionally communicates directly with Google token
and revocation services at `oauth2.googleapis.com`.

The plugin requests the `analytics.readonly` scope. Google receives the administrator’s
authorization request and normal request metadata. Reporting requests include the
selected property, date range, and allowlisted report fields. The plugin does not
add telemetry. Review the [Digital Apps Privacy Policy](https://digitalapps.com/privacy-policy/)
and [Terms](https://digitalapps.com/terms-and-conditions/).

Review Google’s [Privacy Policy](https://policies.google.com/privacy), [Terms of Service](https://policies.google.com/terms),
[OAuth terms](https://developers.google.com/terms/api-services-user-data-policy),
and [Google Analytics terms](https://marketingplatform.google.com/about/analytics/terms/).

## Screenshot

[⌊The connected Free Analytics dashboard shows key metrics, a seven-day traffic 
trend, top pages, and engagement summaries.⌉⌊The connected Free Analytics dashboard
shows key metrics, a seven-day traffic trend, top pages, and engagement summaries
.⌉[

The connected Free Analytics dashboard shows key metrics, a seven-day traffic trend,
top pages, and engagement summaries.

[⌊Guided read-only Google connection explains data access and managed authorization
before the administrator proceeds.⌉⌊Guided read-only Google connection explains 
data access and managed authorization before the administrator proceeds.⌉[

Guided read-only Google connection explains data access and managed authorization
before the administrator proceeds.

[⌊Tracking settings support Google tags, Google Tag Manager containers, additional
destinations, Consent Mode v2 defaults, and explicit installation modes.⌉⌊Tracking
settings support Google tags, Google Tag Manager containers, additional destinations,
Consent Mode v2 defaults, and explicit installation modes.⌉[

Tracking settings support Google tags, Google Tag Manager containers, additional
destinations, Consent Mode v2 defaults, and explicit installation modes.

## Installazione

 1. Upload the `wp-global-site-tag` folder to `/wp-content/plugins/`, or install the
    plugin through WordPress.
 2. Activate **WP Global Site Tag**.
 3. Open **Settings > WP Global Site Tag**.
 4. For reports, click **Connect with Google**, choose an account, property, and website
    data stream.
 5. For manual tracking only, open Tracking settings, enter a valid tag or container
    ID, choose the installation mode, and save.
 6. Verify public tag behavior with Google’s Tag Assistant and verify your consent 
    workflow.

## FAQ

### Can I keep my existing manually configured tag?

Yes. Version 2 preserves it. The Analytics setup looks for an exact stream Measurement
ID match and asks before making any change. If the saved value is a legacy `UA-`
identifier, confirm current collection in GA4 Realtime before replacing or removing
it.

### Why do reports need a Google connection when tracking already works?

Tracking sends data from the public site. Reporting requires separate read-only 
permission to retrieve data from a GA4 property. A manual tag alone does not grant
report access.

### Do I need to create a Google Cloud OAuth application?

No for the recommended connection. Digital Apps owns the OAuth application and required
API configuration. Create your own application only when using the advanced self-
managed route.

### How do I fix redirect_uri_mismatch with my own OAuth application?

Open the advanced connection section, copy its callback URL, and add that exact 
value to your OAuth client’s authorized redirect URIs. Check scheme, host, path,
and trailing slash exactly.

### What happens when Google access is revoked?

The dashboard asks an administrator to reconnect. Tracking remains in its selected
installation mode and the saved tag is not removed.

### Why is a property or stream missing?

Confirm the connected Google account can access the GA4 property, both required 
APIs are enabled, and the property has a Web data stream. Mobile-app streams are
not offered as website choices.

### Why is cached data shown?

During a temporary Google outage or rate limit, the dashboard may show its most 
recent cached report with a clear stale-data notice. Use Refresh after Google is
available again.

### Can Free show more than 7 days?

No. Free provides an inclusive 7-day report. The separately installed Pro add-on
adds 30-day, longer, and custom ranges.

### Does enabling Consent Mode block Google until consent?

No. It queues denied defaults before Google tag configuration, but gtag.js is still
requested. Connect a consent management platform that calls `gtag('consent', 'update',...)`,
or prevent rendering with the provided filter until loading is allowed.

### How do I prevent tag output for selected requests?

Choose an external or disabled installation mode, or return `false` from the `wp_global_site_tag_should_render`
filter. The filter receives the current decision, normalized identifier, and normalized
plugin options.

### What does uninstall remove?

Uninstall removes plugin settings, encrypted Google credentials and tokens, OAuth
state, and registered report caches, including across multisite. Define `WP_GLOBAL_SITE_TAG_PRESERVE_DATA`
as `true` before uninstalling to retain data.

## Recensioni

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

### 󠀁[The Only Google Analytics AND Global site tag setup tool that works](https://wordpress.org/support/topic/the-only-google-analytics-and-global-site-tag-setup-tool-that-works/)󠁿

 [John](https://profiles.wordpress.org/webwiz1/) 23 Novembre 2018

This is my first plugin review and it fully deserves the 5 stars – why? It's extremely
simple to use, not bloated, does not spy on your data and it does exactly what it
promises – you just add your UA code for Google Analytics and then in advanced configuration
your Global site tag, on your "Thank you" page you manually add the "Event snippet"
and there your go – you're all set! Look no further – this is the plugin for Analytics
and Conversions tracking your were looking for.

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

### 󠀁[Very simple to setup, worked fine](https://wordpress.org/support/topic/very-simple-to-setup-worked-fine/)󠁿

 [marknel](https://profiles.wordpress.org/marknel/) 2 Marzo 2018

Super easy to install and setup. A small suggestion would be to add the Settings
hyperlink on the plugin in the Wordpress plugins list, rather than trying to locate
the new Plugin menu on the left sidebar in Wordpress.

 [ Leggi tutte le recensioni di 3 ](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/)

## Contributi e sviluppo

“WP Global Site Tag” è un software open source. Le persone che hanno contribuito
allo sviluppo di questo plugin sono indicate di seguito.

Collaboratori

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

[Traduci “WP Global Site Tag” nella tua lingua.](https://translate.wordpress.org/projects/wp-plugins/wp-global-site-tag)

### Ti interessa lo sviluppo?

[Esplora il codice](https://plugins.trac.wordpress.org/browser/wp-global-site-tag/)
segui il [repository SVN](https://plugins.svn.wordpress.org/wp-global-site-tag/),
segui il [log delle modifiche](https://plugins.trac.wordpress.org/log/wp-global-site-tag/)
tramite [RSS](https://plugins.trac.wordpress.org/log/wp-global-site-tag/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 2.0.3

 * Preserved JavaScript string and regular-expression escapes when saving tracking
   settings.
 * Moved extended date-range controls and comparison calculations into the separately
   distributed Pro add-on.
 * Preserved case-sensitive Analytics metric names and rejected unsupported metric
   selections before caching or requesting reports.

#### 2.0.2

 * Fixed property search so nonmatching Analytics properties are hidden as the administrator
   types.
 * Removed an OAuth Client ID example placeholder that could be mistaken for remotely
   hosted plugin content.

#### 2.0.1

 * Redesigned the Free Analytics dashboard for faster traffic, content, and engagement
   scanning.
 * Added engagement rate, views per session, and sessions per user summaries without
   additional Analytics requests.
 * Replaced the top-content table with a responsive top-pages ranking and refined
   date-range and refresh controls.
 * Added server-owned Analytics dimension filters for compatible Pro reports without
   accepting arbitrary request fields.
 * Updated WordPress compatibility metadata and the factual Pro feature summary.

#### 2.0.0

 * Added a persistent Connect with Google flow, advanced self-managed OAuth, property
   selection, and website data-stream setup.
 * Added Free overview, trend, and top-content reports for an inclusive 7-day range.
 * Added encrypted local connection storage, optional self-managed credentials, 
   safe token refresh and revocation, fixed-host Google API adapters, caching, stale
   fallback, and refresh controls.
 * Added explicit plugin-managed, externally managed, and disabled installation 
   modes without changing existing tracking on upgrade.
 * Preserved legacy `UA-` tracking IDs during upgrades and added guidance for connected
   GA4 destinations.
 * Added centralized entitlements and extension points for the separate Pro add-
   on.
 * Added responsive, keyboard-accessible setup and dashboard interfaces with live
   status announcements.
 * Expanded privacy, external-service, troubleshooting, uninstall, developer, test,
   and release documentation.

#### 1.1.0

 * Added correct, separate rendering for Google tags and GTM containers.
 * Added structured multiple destinations and Consent Mode v2 defaults.
 * Restricted custom JavaScript editing to trusted users and blocked script-tag 
   breakout content.
 * Fixed missing-option warnings, incomplete saves, duplicate configuration, escaping,
   accessibility, and translation issues.
 * Added complete uninstall cleanup, including multisite support and an opt-out 
   constant.
 * Replaced legacy Docker, Gulp, and Webpack tooling with wp-env and smoke tests.

#### 1.0.7

 * Removed warning messages.

#### 1.0.6

 * Added MIME type metadata.

#### 1.0.5

 * Updated the settings label.

#### 1.0.3

 * Added a settings link on the Plugins screen.
 * Moved the settings page under Settings.

#### 1.0.2

 * Updated compatibility metadata for WordPress 5.0.

#### 1.0.0

 * Initial release.

## Meta

 *  Versione **2.0.3**
 *  Ultimo aggiornamento **1 mese fa**
 *  Installazioni attive **7.000+**
 *  Versione WordPress ** 6.3 o superiore **
 *  Testato fino alla versione **7.1.3**
 *  Versione PHP ** 7.4 o superiore **
 *  Lingua
 * [English (US)](https://wordpress.org/plugins/wp-global-site-tag/)
 * Tag
 * [consent mode](https://it.wordpress.org/plugins/tags/consent-mode/)[ga4](https://it.wordpress.org/plugins/tags/ga4/)
   [google analytics](https://it.wordpress.org/plugins/tags/google-analytics/)[google tag](https://it.wordpress.org/plugins/tags/google-tag/)
   [google tag manager](https://it.wordpress.org/plugins/tags/google-tag-manager/)
 *  [Visualizzazione avanzata](https://it.wordpress.org/plugins/wp-global-site-tag/advanced/)

## Valutazioni

 5 su 5 stelle.

 *  [  2 recensioni a 5-stelle     ](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/?filter=5)
 *  [  0 recensioni a 4-stelle     ](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/?filter=4)
 *  [  0 recensioni a 3-stelle     ](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/?filter=3)
 *  [  0 recensioni a 2-stelle     ](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/?filter=2)
 *  [  0 recensioni a 1-stelle     ](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/?filter=1)

[La tua recensione](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/#new-post)

[Vedi tutte le recensioni](https://wordpress.org/support/plugin/wp-global-site-tag/reviews/)

## Collaboratori

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

## Supporto

Hai qualcosa da dire? Ti serve aiuto?

 [Chiedi nel forum di supporto](https://wordpress.org/support/plugin/wp-global-site-tag/)

## Dona

Vuoi supportare lo sviluppo di questo plugin?

 [ Fai una donazione per questo plugin ](https://www.buymeacoffee.com/wpplugins)