How to Obtain User Consent for AppAnalytics in FireMonkey
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
andNo
buttons.
-
- 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.
- If the user selects
-
- 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 toTrue
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:
- AllowTracking property.
- TAppAnalytics.OnPrivacyMessage event handler.
- 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.