How to Obtain User Consent for AppAnalytics in FireMonkey

From RAD Studio
Jump to: navigation, search

Go Up to Using AppAnalytics in FireMonkey


The TAppAnalytics component enforces privacy by obtaining the consent of the end user prior to enable activity tracking. If the user does not give consent, this component remains inert and no data tracking is performed.

Mechanisms to Obtain User Consent in FireMonkey

The FireMonkey implementation of the TAppAnalytics component provides three mechanisms to obtain user consent:

  • TAppAnalytics.PrivacyMessage property. You can set this property with a list of strings that constitute the privacy message. When the user tries to enable the TAppAnalytics component, this message is displayed in a dialog window with Yes and No buttons.
PrivacynoticeFMX.png
  • If the user selects Yes, this means that the user has given consent and therefore you can instantiate and register an activity listener object. Thus, the user consent is saved.
  • If the user selects No, then the user denies permission and you should not create an activity listener object. In this case, the TAppAnalytics component will remain inactive.
  • TAppAnalytics.OnPrivacyMessage event. You can alternatively implement an event handler to define a custom mechanism for obtaining user consent that allows activity tracking. The TAppAnalytics.OnPrivacyMessage includes an input variable Activity that you have to set to True during this event handler. In this way, you instantiate and register an activity listener object.
  • AllowTracking property. You should only use this property if the user has previously provided consent either via one of the other two mechanisms or through some external legal agreement. This property is intended to allow you to save the user consent in an application setting file and retrieve this setting during the startup sequence.

How Do the Mechanisms Precede

The order of precedence of these mechanisms are as follows:

  1. AllowTracking property.
  2. TAppAnalytics.OnPrivacyMessage event handler.
  3. TAppAnalytics.PrivacyMessage property.

For example, if you define the OnPrivacyMessage event handler, then this event will take precedence over the PrivacyMessage text and this text will not be displayed.

See Also