JVEsoft Suite - Analytics Pack with Full Source Code
JVEsoft Suite - Analytics Pack with Full Source Code
This component links your application to the Google Analytics service. Use it if you want to track app usage statistics (you might need to get user’s permissions before gathering his information; unless specifically coded, this component does not send user-identifiable information). The following properties are exposed by this component:
PropertyId – the property, defined within the Google Analytics service. See http://www.google.com/analytics/ for details. The property must be created as an App, not Site.
Collect – specifies the type of events, which the component will keep track of, automatically. See below.
This component does not expose any events and the methods it is exposing are directed specifically to tracking data to servers.
See below for Manual Tracking and Automatic Tracking of events. The component is implemented to cache events and send them out 1 per second in a parallel thread. It also uses a persistent first-in-first-out queue. All in all this means that performance will not be affected and no further considerations need to be taken into account, when using this component.
Notice, Google Analytics tracking is not immediate! Several hours might be required for the data to be correctly aggregated and presented within the Google Analytics site.
This component is available for VCL and for FMX, though for VCL it is only compatible with Delphi XE8 and later.
Manual Tracking
The following methods are exposed by this component to help you send tracking events to the Google Analytics servers:
TrackScreen(Screen) – use this to track a change in the current screen, i.e. another screen being opened.
TrackEvent(Category, Action, Label = ”, Value = 0) – use this to track arbitrary events; level and value figures are optional.
TrackSocial(Network, Action, Target) – use this to track events, which could be considered to be social networks oriented.
TrackException(Exception, Fatal = True) – use this to track exceptions or other errors. Set Fatal to True to indicate that the error was fatal.
TrackTransaction(TransactionId, Affiliation, Revenue, Shipping, Tax, Currency) – this function can be used to start a payment transaction; you list the transaction content using the next function. The TransactionId should be unique.
TrackItem(TransactionId, ItemName, Price, Quantity, Code, Category, Currency) – allows you to list the transaction content; the TransactionId of the items must be the same as passed to the TrackTransaction
In addition to the procedures listed above, there is the same set, prefixed with Broadcast (instead of Track), which performs the same action, but sends the information to all active TJVEAnalytics components, not just the current one (these are class procedures).
See Google Analytics website for more information about tracking your application. Helper routines are also available to transmit raw data to the servers (see component source code for more details).
Automatic Tracking
In addition to providing facilities to report events, the component is also capable of reporting various events on its own. To control this behaviour, the Collect property can be used, providing the following options:
acFormSwitches – tracks when a new form becomes active.
acExceptions – tracks all uncaught exceptions (see below for more details).
acJVEAppRater – tracks activations of TJVEAppRater
acJVEAppStore – tracks activations of TJVEAppStore
acJVEBrowser – tracks all embedded browser executions (including the URL).
acJVEEmail – tracks activations of TJVEEmail
acJVEOpenURL – tracks all external browser executions (also tracks the URLs themselves).
acJVEPayment – tracks all TJVEPayment payments as app revenues.
acJVESocial – tracks activations of TJVESocial
acJVEPushes – tracks all push notification registrations and pushes.
If you ever use the acExceptions option, the component will override the global Application.OnException event. If you need to use this event in your code, use the global ApplicationException variable instead; the component will forward all exceptions there.
Only for V.I.P
Warning! You are not allowed to view this text.