Tracking Custom Events with TAppAnalytics in Multi-Device Applications
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); begin AppAnalytics1.Enabled := True; end; procedure TForm1.TriggerEventButtonClick(Sender: TObject); var Context: TCustomEventContext; begin if Application.TrackActivity then begin Context := TCustomEventContext.Create('Customer_Timezone', 'Recorded Locale with UTC Offset ', TTimeZone.Local.DisplayName,TTimeZone.Local.UtcOffset.Hours); Application.AnalyticsManager.RecordActivity(TAppActivity.Custom, TriggerEventbutton, Context); end; end; end.
We are doing a developer skill sprint on app analytics on May 19th. You can register for the webinar by going to http://embt.co/Sprints15.
To learn more about App Analytics with RAD Studio XE8, visit http://www.embarcadero.com/products/appanalytics
Please login first in order for you to submit comments
- Page :
That is the case for VCL, but FireMonkey handles tracking custom app analytics events differently.