Class TAnalytics

Unit

Declaration

type TAnalytics = class(TComponent)

Description

Gathering analytics through Google Analytics https://www.google.com/analytics/ and / or Game Analytics http://www.gameanalytics.com/ .

Available on Android or iOS. You will need to also add appropriate "service" to your application, like game_analytics or google_analytics to have the integration code automatically included. See Android services ( https://castle-engine.io/android_services ), iOS services ( https://castle-engine.io/ios_services ) and CastleEngineManifest.xml docs ( https://castle-engine.io/project_manifest ).

Usage:

  1. Create an instance of this class (only a single instance allowed).

  2. Initialize at least one analytics backend using the InitializeGoogleAnalytics or InitializeGameAnalytics method.

  3. Use the remaining methods, like Event, to report events in your app.

Hierarchy

  • TObject
  • TPersistent
  • TComponent
  • TAnalytics

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure InitializeGoogleAnalytics(const AnalyticsPropertyId: String);
Public procedure InitializeGameAnalytics(const GameKey, SecretKey: String);
Public procedure ScreenView(const ScreenName: String);
Public procedure Event(const Category, Action, ALabel: String; const Value: Int64); overload;
Public procedure Event(const Category, Action, ALabel: String; const Value: Int64; const DimensionIndex: Cardinal; const DimensionValue: String); overload;
Public procedure Timing(const Category, AVariable, ALabel: String; const Time: TFloatTime);
Public procedure Progress(const Status: TAnalyticsProgress; const World: String; const Level: String = ''; const Phase: String = ''; const Score: Integer = 0);

Description

Methods

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public procedure InitializeGoogleAnalytics(const AnalyticsPropertyId: String);

Initialize Google Analytics https://www.google.com/analytics/ . Usually called from TCastleApplication.OnInitialize.

Public procedure InitializeGameAnalytics(const GameKey, SecretKey: String);

Initialize Game Analytics http://www.gameanalytics.com/ . Usually called from TCastleApplication.OnInitialize.

Public procedure ScreenView(const ScreenName: String);

Send to analytics view of the screen, e.g. when user switches between UI states.

Exceptions raised
EInvalidChar
If the screen name contains invalid characters. Use only ASCII letters, digits, hyphens, underscores.
Public procedure Event(const Category, Action, ALabel: String; const Value: Int64); overload;

Send to analytics a general event.

Exceptions raised
EInvalidChar
If some string contains invalid characters. Use only ASCII letters, digits, hyphens, underscores for the category and other strings.
Public procedure Event(const Category, Action, ALabel: String; const Value: Int64; const DimensionIndex: Cardinal; const DimensionValue: String); overload;

Send to analytics a general event, along with a custom dimension. DimensionIndex must be > 0.

See https://developers.google.com/analytics/devguides/collection/android/v4/customdimsmets#overview about what is a custom dimension for Google Analytics (you need to create the dimension index first in Google Analytics console).

For Game Analytics, this is just used as an extra subcategory. Do not create too many different DimensionIndex + DimensionValue combinations, as each combination creates a new unique event id, and these are limited, see http://www.gameanalytics.com/docs/custom-events .

Exceptions raised
EInvalidChar
If some string contains invalid characters. Use only ASCII letters, digits, hyphens, underscores for the category and other strings.
Public procedure Timing(const Category, AVariable, ALabel: String; const Time: TFloatTime);

Send to analytics a timing event.

Exceptions raised
EInvalidChar
If some string contains invalid characters. Use only ASCII letters, digits, hyphens, underscores for the category and other strings.
Public procedure Progress(const Status: TAnalyticsProgress; const World: String; const Level: String = ''; const Phase: String = ''; const Score: Integer = 0);

Send to analytics a progress event.

Exceptions raised
EInvalidChar
If some string contains invalid characters. Use only ASCII letters, digits, hyphens, underscores for the world and other strings.

Generated by PasDoc 0.16.0-snapshot.