![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <IAnalyticsProvider.h>
Inheritance diagram for IAnalyticsProvider:Generic interface for an analytics provider. Other modules can define more and register them with this module. See FAnalytics for details.
Easiest way to use this is like so:
// MakeAnalyticsEventAttributeArray is a convenient way to efficiently make an array of attributes // Since it returns an unnamed temporary, the compiler automatically selects the move-aware version. AnalyticsProvider->RecordEvent(TEXT("MyEvent"), MakeAnalyticsEventAttributeArray("Attr1", "Value1", ... )); or: TArray<FAnalyticEventAttribute> Attrs; Attrs.Add(...); AnalyticsProvider->RecordEvent(TEXT("MyEvent"), Attrs);
Several APIs build off the pure virtual ones. The following pure virtuals must be implemented by a derived class.
virtual bool StartSession(const TArray<FAnalyticsEventAttribute>& Attributes) virtual void EndSession() virtual FString GetSessionID() const virtual bool SetSessionID(const FString& InSessionID) virtual void FlushEvents() virtual void SetUserID(const FString& InUserID) virtual FString GetUserID() const
virtual void RecordEvent(const FString& EventName, const TArray<FAnalyticsEventAttribute>& Attributes)
There are several other methods to record specific types of events. They were added for legacy reasons to support specific third party implementations. Derived classes generally do not have to worry about them.
|
inlinevirtual |
Ends the session. Usually no need to call explicitly, as the provider should do this for you when the instance is destroyed.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
Flush any cached events to the analytics provider.
Note that not all providers support explicitly sending any cached events. In which case this method does nothing.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
|
pure virtual |
Used with GetDefaultEventAttributeCount to iterate over the default attributes.
Range checking is not done, similar to TArray. Use GetDefaultAttributeCount() first!
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
Used with GetDefaultAttribute to iterate over the default attributes.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
|
pure virtual |
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
|
pure virtual |
Gets the opaque session identifier string for the provider.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
|
pure virtual |
Gset the current UserID. Use -ANALYTICSUSERID=<Name> command line to force the provider to use a specific UserID for this run.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
|
inlinevirtual |
Record a gift of in-game currency from the game itself.
Note that not all providers support currency events. In this case this method is equivalent to sending a regular event with name "Currency Given".
| GameCurrencyType | - type of in game currency given, should be registered with the provider first. |
| GameCurrencyAmount | - amount of in game currency given. |
|
inlinevirtual |
Record a gift of in-game currency from the game itself.
Note that not all providers support currency events. In this case this method is equivalent to sending a regular event with name "Currency Given".
| GameCurrencyType | - type of in game currency given, should be registered with the provider first. |
| GameCurrencyAmount | - amount of in game currency given. |
| EventAttrs | - a list of key/value pairs to assign to this event |
|
inlinevirtual |
Record an in-game purchase of a an item.
Note that not all providers support item purchase events. In this case this method is equivalent to sending a regular event with name "Item Purchase".
| ItemId | - the ID of the item, should be registered with the provider first. |
| ItemQuantity | - the number of Items purchased. |
|
inlinevirtual |
Record a purchase of in-game currency using real-world money.
Note that not all providers support currency events. In this case this method is equivalent to sending a regular event with name "Currency Purchase".
| GameCurrencyType | - type of in game currency purchased, should be registered with the provider first. |
| GameCurrencyAmount | - amount of in game currency purchased. |
| RealCurrencyType | - real-world currency type (like a 3-character ISO 4217 currency code, but provider dependent). |
| RealMoneyCost | - cost of the currency in real world money, expressed in RealCurrencyType units. |
| PaymentProvider | - Provider who brokered the transaction. Generally arbitrary, but examples are PayPal, Facebook Credits, App Store, etc. |
|
inlinevirtual |
Record a purchase of in-game currency using real-world money.
Note that not all providers support currency events. In this case this method is equivalent to sending a regular event with name "Currency Purchase".
| GameCurrencyType | - type of in game currency purchased, should be registered with the provider first. |
| GameCurrencyAmount | - amount of in game currency purchased. |
| EventAttrs | - a list of key/value pairs to assign to this event |
Records an error that has happened in the game
Note that not all providers support all events. In this case this method is equivalent to sending a regular event with name "Game Error".
| Error | - the error string to record |
|
inlinevirtual |
Records an error that has happened in the game
Note that not all providers support all events. In this case this method is equivalent to sending a regular event with name "Game Error".
| Error | - the error string to record |
| EventAttrs | - a list of key/value pairs to assign to this event |
|
inline |
Overload for RecordEvent that takes no parameters
| EventName | name of the event |
|
inline |
Overload for RecordEvent that takes a single attribute
| EventName | name of the event |
| Attribute | attribute name and value |
|
inline |
Overload for RecordEvent that takes a single name/value pair
| EventName | name of the event |
| ParamName | attribute name |
| ParamValue | attribute value |
|
pure virtual |
Records a named event with an array of attributes
| EventName | name of the event |
| Attributes | array of attribute name/value pairs |
Implemented in FAnalyticsProviderBroadcast, and FAnalyticsProviderLog.
|
inlinevirtual |
RecordEvent overload to allow platforms to support events that are immediately sent
| EventName | name of the event |
| Attributes | array of attribute name/value pairs |
| Mode | the record event mode, Cached or Immediate |
Reimplemented in FAnalyticsProviderBroadcast.
|
inlinevirtual |
Record an in-game purchase of a an item.
Note that not all providers support item purchase events. In this case this method is equivalent to sending a regular event with name "Item Purchase".
| ItemId | - the ID of the item, should be registered with the provider first. |
| Currency | - the currency of the purchase (ie, Gold, Coins, etc), should be registered with the provider first. |
| PerItemCost | - the cost of one item in the currency given. |
| ItemQuantity | - the number of Items purchased. |
|
inline |
Record an in-game purchase of a an item.
Note that not all providers support item purchase events. In this case this method is equivalent to sending a regular event with name "Item Purchase".
| ItemId | - the ID of the item, should be registered with the provider first. |
| ItemQuantity | - the number of Items purchased. |
|
inlinevirtual |
Record an in-game purchase of a an item.
Note that not all providers support item purchase events. In this case this method is equivalent to sending a regular event with name "Item Purchase".
| ItemId | - the ID of the item, should be registered with the provider first. |
| ItemQuantity | - the number of Items purchased. |
| EventAttrs | - a list of key/value pairs to assign to this event |
|
inlinevirtual |
Record a player progression event that has happened in the game
Note that not all providers support all events. In this case this method is equivalent to sending a regular event with name "Progression".
| Error | - the error string to record |
|
inlinevirtual |
Record a player progression event that has happened in the game
Note that not all providers support all events. In this case this method is equivalent to sending a regular event with name "Progression".
| Error | - the error string to record |
|
inlinevirtual |
Record a player progression event that has happened in the game
Note that not all providers support all events. In this case this method is equivalent to sending a regular event with name "Progression".
| Error | - the error string to record |
Sets the location the game believes the user is playing in as part of the session
Sets a user defined string as the build information/version for the session
|
pure virtual |
Sets an array of attributes that will automatically be appended to any event that is sent. Logical effect is like adding them to all events before calling RecordEvent. Practically, it is implemented much more efficiently from a storage and allocation perspective.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
Sets the gender the game believes the user is as part of the session
Sets the location the game believes the user is playing in as part of the session
Sets the session ID of the analytics session. This is not something you normally have to do, except for circumstances where you need to send events on behalf of another user (like a dedicated server sending events for the connected clients).
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
Set the UserID for use with analytics. Some providers require a unique ID to be provided when supplying events, and some providers create their own. If you are using a provider that requires you to supply the ID, use this method to set it.
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.
|
inline |
Starts a session. It's technically legal to send events without starting a session. The use case is for backends and dedicated servers to send events on behalf of a user without technically affecting the session length of the local player. Local players log in and start/end the session, but remote players simply call SetUserID and start sending events, which is legal and analytics providers should gracefully handle this. Repeated calls to this method will be ignored.
|
inline |
Overload for StartSession that takes a single attribute
| Attribute | attribute name and value |
|
inline |
Overload for StartSession that takes a single name/value pair
| ParamName | attribute name |
| ParamValue | attribute value |
|
pure virtual |
Starts a session. See parameterless-version for contract details.
| Attributes | attributes of the session. Arbitrary set of key/value pairs that will be sent with the StartSession event that this should also trigger. |
Implemented in FAnalyticsProviderLog, and FAnalyticsProviderBroadcast.