Tracking Custom Events with TAppAnalytics in Multi-Device Applications

Posted by on in Tools

Luis Navarro recently wrote a great post on using the new TAppAnalytics component in your VCL and FireMonkey applications to track application usage.

Today, I thought I would provide a quick FireMonkey code snippet that shows you how to track custom data. In this example, I am able to capture the application user's local timezone and the UTC offset.

When creating the Context Object, none of the three strings can be empty. The parameters are Category, Action, Text and Value.

uses System.Analytics, System.Analytics.AppAnalytics, System.DateUtils, System.TimeSpan;

procedure TForm1.EnableButtonClick(Sender: TObject);
  AppAnalytics1.Enabled := True;

procedure TForm1.TriggerEventButtonClick(Sender: TObject);
  Context: TCustomEventContext;
  if Application.TrackActivity then
    Context := TCustomEventContext.Create('Customer_Timezone', 'Recorded Locale with UTC Offset ', TTimeZone.Local.DisplayName,TTimeZone.Local.UtcOffset.Hours);
    Application.AnalyticsManager.RecordActivity(TAppActivity.Custom, TriggerEventbutton, Context);



We are doing a developer skill sprint on app analytics on May 19th. You can register for the webinar by going to

To learn more about App Analytics with RAD Studio XE8, visit 

Trial Banner

Gold User, Rank: 5, Points: 558
Senior Product Manager, RAD Studio


  • Sarina D
    Sarina D Thursday, 14 May 2015

    Hi Fred,
    That is the case for VCL, but FireMonkey handles tracking custom app analytics events differently.


  • Fred Ahrens
    Fred Ahrens Thursday, 7 May 2015

    Why don't you just call TAppAnalytics.TrackEvent?

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: