Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Respecting User Privacy

Steve McKay edited this page Oct 24, 2013 · 16 revisions

The Chrome Platform Analytics (CPA) library lets you collect information about user interactions with your application and send that information to Google Analytics servers. This clearly has privacy implications for your users. In order to use the CPA library you must abide by Google Analytics Policies, which address such issues as:

  • notifying users about your tracking practices;
  • obtaining consent from users or giving them with the option to opt-out of tracking; and
  • not uploading personally identifying information to Google Analytics.

In order to facilitate compliance with these policies, the CPA library provides built-in support to disable tracking. This support is implemented through a permission setting that is both persistent (the state of the setting is stored in local storage) and dynamic (the CPA library honors the setting automatically so you don't have to implement an opt-out feature manually).

To enable or disable tracking, use the setTrackingPermitted(boolean) method of analytics.Config.

Notes:

  • The CPA library does not provide a user interface for the tracking permission setting – your application must do that. See the example applications for examples of how you might implement a user interface for this setting.

    Example:

      service.getConfig().addCallback(
          /** @param {!analytics.Config} config */
          function(config) {
            var permitted = myApp.askUser('Allow anonymous usage tracking?');
            config.setTrackingPermitted(permitted);
            // If "permitted" is false the library will automatically stop
            // sending information to Google Analytics and will persist this
            // behavior automatically.
          });
    
  • The storage mechanism used to persist the tracking permission setting is only accessible asynchronously. For this reason access to the representative analytics.Config object is asynchronous as well. See the example applications for an illustration of how to accommodate this in your code.

Clone this wiki locally