Because advertising features can be enabled through your Google Analytics admin settings, there may be cases where you need to disable them programmatically. If you’ve configured Connected Site Tags, you’ll need to Set up the Analytics tag if you want this signal to propagate to your Connected Site Tags.
Disable all advertising features
The following configurations give you the ability to disable remarketing and advertising reporting features and override any property settings established in the Google Analytics user interface.
To disable all advertising features with gtag.js, set allow_google_signals
to
false
:
gtag('set', 'allow_google_signals', false);
To disable advertising features with gtag.js on a specific property, edit the
config
command for the given GA_MEASUREMENT_ID
and set
allow_google_signals
to false
:
gtag('config', 'GA_MEASUREMENT_ID', {'allow_google_signals': false});
Disable advertising personalization
The following configurations give you the ability to disable advertising personalization features.
To disable all advertising personalization with gtag.js, set
allow_ad_personalization_signals
to false
:
gtag('set', 'allow_ad_personalization_signals', false );
To disable advertising personalization with gtag.js on a specific property, edit
the config
command for the given GA_MEASUREMENT_ID
and set
allow_ad_personalization_signals
to false
:
gtag('config', 'GA_MEASUREMENT_ID', { 'allow_ad_personalization_signals': false });
You can also control whether data collected from users for any property may be used for ads personalization via the ads personalization setting.