VCL.AppAnalytics Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to use AppAnalytics in VCL to collect application usage data.


You can find the VLCAnalytics sample project at:


This sample demonstrates how to use the TAppAnalytics component with the purpose of collecting application usage data. AppAnalytics anonymously tracks the usage of this sample, and then sends the data for analysis. You can see the analysis of usage of this sample in the AppAnalytics web interface.

Getting Your Application ID

To run the sample, you need an Application ID that uniquely identifies your application. The Application ID is provided by the AppAnalycis web interface. To get an Application ID:

  1. Go to AppAnalytics web interface and sign in; you can sign in with your EDN account.
  2. Once you have signed in, you need to create a new application.
  3. Enter the Application Name and click Save. Then, AppAnalycis provides you with an Application ID.
  4. You need to copy the full Application ID, including both curly brackets { and }, as you need to add this ID in the ApplicationID property of the TAppAnalytics component.

You can view the Application ID at any time by signing in to the AppAnalytics web interface.

How to Use the Sample

  1. Navigate to the location given above and open VCLAnalytics.dproj.
  2. Click on the TAppAnalytics component located on the form, and set the ApplicationID property to the Application ID you obtained in the above section getting your Application ID.
  3. Press F9 or choose Run > Run.
  4. When the sample runs:
  • Click the Enable AppAnalytics Tracking button so the sample collects the application usage data.
  • Click the Check Permission button to display the privacy message.
  • Click the Launch Form 2 button to show the Form2.
  • Click Raise and Log Exception to raise an exception.
  • Click on the ControlFocusEdit so AppAnalycis detects the focus on this control, then this focus can be later included in the analysis.
Note: The above bullet points are used by AppAnalytics for analysis purposes. Go to the AppAnalytics web interface to see the analysis of the usage of this sample.


File Contains


The project itself.


The main VCL form file where the components are located.


Used to define and implement the sample.


Another VCL form the sample uses for analysis purposes.


  • TAppAnalytics is the AppAnalytics component used to track usage, and collect data from the VCL sample.
  • The TAppAnalytics.ApplicationID property is the unique ID that identifies the application. This key is provided by the AppAnalytics web interface.
  • To create an exception, the TCustomForm.Show method is called, with a TForm variable set to nil. By doing this, the sample raises an exception that can be captured by AppAnalytics.
  • A second form, Form2, is shown with the purpose of gathering data for user flow analysis between forms.


See Also