Using AppAnalytics in VCL

From RAD Studio
Jump to: navigation, search

Go Up to VCL

RAD Studio integrates AppAnalytics for VCL Win32 and VCL Win64 applications written in Delphi and C++Builder.

AppAnalytics for VCL uses Windows Message Queues to get the application data.

How to Get Started Using AppAnalytics in VCL

To start using AppAnalytics in VCL, you need to drop a TAppAnalytics component AppAnalytics.png into your application. Then, in the Object Inspector, you need to add the ApplicationID.

Note: You need to get an AppAnalytics account and an Application ID to be able to use AppAnalytics in your application.

After AppAnalytics is active, the usage analytics is available in a few minutes in the AppAnalytics web interface

Activating/Deactivating Data Collection with AppAnalytics

You can activate AppAnalytics at design time so that you get information for the entire usage application session. However, you can also allow the user to activate AppAnalytics at run time.

The first time the user activates AppAnalytics, a privacy message is displayed that notifies the user that his actions are being tracked. AppAnalytics collects only anonymous data. The privacy message is shown in a dialog box with an OK message, but does not allow the end user to activate or deactivate the tracking of information.


Note: The image shows the default text of the Privacy Notice. You can, however, change this text by modifying the PrivacyMessage property.

In order to give the end user the capability of starting/stopping the tracking of information, you can use the CheckPrivacy method that AppAnalytics implements in VCL. This method displays a dialog box that asks the user for permission.


Warning: Neither you nor any of your users should send any personal, private, or identifiable information over this connection. To do so is a violation of the privacy policy.

Configuring Tracking Options for AppAnalytics in VCL

You can decide the data that AppAnalytics automatically collects by selecting any combination of the parameters in the TAppAnalytics.Options property.

By default, when you activate AppAnalytics in VCL, it tracks the following:

  • The application starts and closes (aoTrackStartup).
  • The active form in the application changes (aoTrackFormActivate).
  • An exception raises to the top and is caught at the application level (aoTrackExceptions).

AppAnalytics also implements TrackEvent, which allows you to do custom event tracking in case you want to track feature usage, performance data, or any other events, provided that the information remains anonymous.

Other Configuration Options

Using the CacheSize property, you can define the maximum number of events that AppAnalytics collects before sending them to the server for analysis. This property is set to 500 by default.

You can also decide the interval at which AppAnalytics automatically sends the data it has collected to the server for analysis. This interval is set in miliseconds using the UpdateInterval property. The default value is 600 miliseconds.

How AppAnalytics Counts End Users

AppAnalytics counts an end user as a user of a single application on a single user account on a client machine. Specifically, an end user is a combination of one ApplicationID and one Windows user account (determined by the HKEY_CURRENT_USER registry key).

Custom Event Tracking

AppAnalytics allows the developer to create custom events with a single code line. Custom event tracking helps the developer to find more about how the users use the application, for example, when the user clicks a button, when the user selects an option from a menu, a drag and drop operation etc.

To track a custom event, you need to call the TrackEvent method of TAppAnalytics.

See Vcl.AppAnalytics.TAppAnalytics.TrackEvent and Tracking Custom Events Code Snippet on VCL for more information.

See Also

Code Samples