Skip to content

Instantly share code, notes, and snippets.

@shazron
Last active September 9, 2023 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shazron/bd5e174c0ae2bd1fcede378f2f73b649 to your computer and use it in GitHub Desktop.
Save shazron/bd5e174c0ae2bd1fcede378f2f73b649 to your computer and use it in GitHub Desktop.
Google Ad Privacy Preferences json settings

Google Ad Privacy Settings (JSON)

Sept 10th 2023

Location

  1. In Google Chrome, go to chrome://settings/adPrivacy
  2. In Windows, make sure Chrome is closed, and load the file %LOCALAPPDATA%\Google\Chrome\User Data\Default\Preferences in a text editor and format it as JSON.

Chrome Ad Privacy Notice

Snag_6e001d4

Note that either option will set all 3 Ad Privacy options (Ad measurement, Site-suggested Ads, and Ad topics) to true, which means that all tracking will be set to true no matter what you choose.

Preferences (.privacy_sandbox.m1 key)

{
  "privacy_sandbox": {
    "anti_abuse_initialized": true, // not sure what this is, but is set before you choose "Got it" or "Settings"
    "m1": {
      "ad_measurement_enabled": true, // Ad measurement
      "fledge_enabled": true, // Site-suggested ads
      "row_notice_acknowledged": true, // this will toggle showing the modal window above on or off
      "topics_enabled": true // Ad topics
    }
  }
}

Ad topics

If you disable Ad topics in Chrome settings in the UI, it will show in the Preferences like so, with an extra .privacy_sandbox.m1.topics_consent property:

{
  "privacy_sandbox": {
    "anti_abuse_initialized": true,
    "m1": {
      "ad_measurement_enabled": true,
      "fledge_enabled": true,
      "row_notice_acknowledged": true,
      "topics_enabled": false
    },
    "topics_consent": {
      "consent_given": false,
      "last_update_reason": 2,
      "last_update_time": "13338750876099363", // this varies based on when you changed it last, of course
      "text_at_last_update": "Ad topics Ad topics Topics of interest are based on your recent browsing history and are used by sites to show you personalized ads Your topics You can block topics you don’t want shared with sites. Chrome also auto-deletes your topics older than 4 weeks. Learn more No topics to show right now More about ad topics Chrome notes topics of interest based on your browsing history from the last few weeks. Later, a site you visit can ask Chrome for your topics to personalize the ads you see. Chrome shares up to 3 topics while protecting your browsing history and identity. Chrome auto-deletes topics that are older than 4 weeks. As you keep browsing, a topic might reappear on the list. Or you can block topics you don’t want Chrome to share with sites. Learn more about managing your ad privacy in Chrome. Topics you blocked Blocked topics appear here As you browse, whether an ad you see is personalized depends on this setting, Site-suggested ads, your cookie settings, and if the site you’re viewing personalizes ads"
    }
  }
}

Turn off all 3 settings programmatically

  1. Use your favorite scripting language
  2. Open up the Preferences file for your Chrome profile (Windows path above, research the location for Linux, macOS)
  3. Set .privacy_sandbox.m1.ad_measurement_enabled to false
  4. Set .privacy_sandbox.m1.fledge_enabled to false
  5. Set .privacy_sandbox.m1.topics_enabled to false
  6. If available, set .privacy_sandbox.topics_consent.consent_given to false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment