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

Respecting User Privacy

aorion edited this page Jul 26, 2013 · 16 revisions

Use of the Chrome Platform Analytics (CPA) library has privacy implications for users of your application, since information collected by using the library is sent to the Google Analytics servers. In order to use the CPA library you must abide by Google Analytics Policies, which address issues such as:

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

In order to facilitate compliance with Google Analytics policies, the CPA library provides built-in support to disable tracking through a permission setting. This setting is both persistent (state is stored in local storage) and dynamic (the CPA library honors the setting automatically so you don't have to implement this feature manually). You can enable or disable tracking using the setTrackingPermitted(boolean) method of analytics.Config.

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

Example:

service.getConfig().addCallback(
    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.
    });

Note that the underlying storage mechanism used to persist this setting is only accessible asynchronously. For this reason access to the representative analytics.Config object is asynchronous as well. See the demo applications for an example of how to accommodate this in your code.

Clone this wiki locally