Quantcast
Channel: Sarina DuPont, Product Manager RAD Studio
Viewing all articles
Browse latest Browse all 132

Tracking Custom Events with TAppAnalytics in Multi-Device Applications

$
0
0

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.

 AppAnalytics

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 

Trial Banner


Viewing all articles
Browse latest Browse all 132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>