-
Notifications
You must be signed in to change notification settings - Fork 96
Respecting User Privacy
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 obviously has privacy implications for your users. 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, or providing them with the option to opt-out of tracking; and
- not uploading personally identifying information to the Google Analytics servers.
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 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 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 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.