Google Analytics Measurement Protocol 1.1.2
Google Analytics plugin for Unreal Engine, using a native cross-platform implementation of the Measurement Protocol.
Loading...
Searching...
No Matches
Static Public Member Functions | Friends | List of all members
UGoogleAnalyticsMPStatics Class Reference

Google Analytics Measurement Protocol static methods that can be called from both Blueprint and C++. More...

#include <GAMPStatics.h>

Inheritance diagram for UGoogleAnalyticsMPStatics:

Static Public Member Functions

static void EndSession (const TMap< FString, FString > &Attributes)
 Ends a user session. More...
 
static class UGoogleAnalyticsMPAttributesFilterGetAttributesFilter ()
 Get the Attributes Filter instantiated internally (. More...
 
static bool GetOptOut ()
 Get the status of the "opt out" option. More...
 
static void RecordNamedEvent (const FString &EventName, const TMap< FString, FString > &Attributes)
 Records an "event" hit type (low level interface). More...
 
static void RecordPurchase (const FGoogleAnalyticsMPPurchaseInfo &PurchaseInfo)
 Records a "transaction" hit type. More...
 
static void RecordScreenView (const FString &ScreenName, const TMap< FString, FString > &Attributes)
 Records a "screenview" hit type to log how the user is moving inside your game/application. More...
 
static void RecordStructuredEvent (const FString &EventCategory, const FString &EventAction, const FString &EventLabel, const int32 EventValue, const TMap< FString, FString > &Attributes)
 Records an "event" hit type. More...
 
static void RecordStructuredEvent (const FString &EventCategory, const FString &EventAction, const FString &EventLabel, const TMap< FString, FString > &Attributes)
 Records an "event" hit type. More...
 
static void RecordStructuredEventWithValue (const FString &EventCategory, const FString &EventAction, const FString &EventLabel, const int32 EventValue, const TMap< FString, FString > &Attributes)
 Records an "event" hit type (with an associated value). More...
 
static void ResetPersistentData ()
 Reset any persistent and cached data. More...
 
static void SetOptOut (bool bOptOut)
 Set if "opt-out" from all analytics logging. More...
 
static void SetUserID (const FString &UserID)
 Set the know unique identifier of the current user. More...
 
static void StartSession (const TMap< FString, FString > &Attributes)
 Start a user session. More...
 

Friends

class IGoogleAnalyticsMPProvider
 

Detailed Description

Google Analytics Measurement Protocol static methods that can be called from both Blueprint and C++.

This class provides the plugin API, including methods for ordinary event logging and methods to manage advanced features like session handling, opt-out, cached storage, etc.

Member Function Documentation

◆ EndSession()

static void UGoogleAnalyticsMPStatics::EndSession ( const TMap< FString, FString > &  Attributes)
static

Ends a user session.

If UGoogleAnalyticsMPSettings::bAutoSessionHandling is false, you must call this method when your application ends.

◆ GetAttributesFilter()

static class UGoogleAnalyticsMPAttributesFilter * UGoogleAnalyticsMPStatics::GetAttributesFilter ( )
static

Get the Attributes Filter instantiated internally (.

See also
UGoogleAnalyticsMPAttributesFilter). It can be null.
Returns
the UGoogleAnalyticsMPAttributesFilter instance if the UGoogleAnalyticsMPSettings::AttributesFilterClass was set in settings, nullptr otherwise.

◆ GetOptOut()

static bool UGoogleAnalyticsMPStatics::GetOptOut ( )
static

Get the status of the "opt out" option.

See also
SetOptOut() for more information.
Returns
True if no data to Google Analytics is sent and calls to log events are silently ignored.

◆ RecordNamedEvent()

static void UGoogleAnalyticsMPStatics::RecordNamedEvent ( const FString &  EventName,
const TMap< FString, FString > &  Attributes 
)
static

Records an "event" hit type (low level interface).

Attention
Please use RecordStructuredEvent() or RecordStructuredEventWithValue() instead when possible, Google Analytics Universal REQUIRES some attributes with events and wrong usages of this method could result in missed logged events.
Parameters
EventNameEvent name.
AttributesOptional auxiliary Google Analytics Measurement Protocol attributes (see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters).

◆ RecordPurchase()

static void UGoogleAnalyticsMPStatics::RecordPurchase ( const FGoogleAnalyticsMPPurchaseInfo PurchaseInfo)
static

Records a "transaction" hit type.

Transactions are purchase of items with real money.

Parameters
PurchaseInfoThe purchase information about the transaction.

◆ RecordScreenView()

static void UGoogleAnalyticsMPStatics::RecordScreenView ( const FString &  ScreenName,
const TMap< FString, FString > &  Attributes 
)
static

Records a "screenview" hit type to log how the user is moving inside your game/application.

In Unreal Engine, you can use it to track the user navigation between menus and maps.

Parameters
ScreenNameThe screen name as logged in Google Analytics.
AttributesOptional auxiliary Google Analytics Measurement Protocol attributes (see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters).

◆ RecordStructuredEvent() [1/2]

static void UGoogleAnalyticsMPStatics::RecordStructuredEvent ( const FString &  EventCategory,
const FString &  EventAction,
const FString &  EventLabel,
const int32  EventValue,
const TMap< FString, FString > &  Attributes 
)
inlinestatic

Records an "event" hit type.

Events are user interactions with content other than screen views.

Read more about Google Analytics events here: https://support.google.com/analytics/answer/1033068?hl=en. To add further custom data to events, read about the Custom Dimensions and Metrics: https://support.google.com/analytics/answer/2709828?hl=en.

If you must log an event with a numeric value associated, you can use RecordStructuredEventWithValue().

Parameters
EventCategoryEvent category (required, it must not be empty).
EventActionEvent action (required, it must not be empty).
EventLabelEvent label (optional, can be empty).
EventValueEvent value (required, use the other RecordEvent* methods if the value must not be logged).
AttributesOptional auxiliary Google Analytics Measurement Protocol attributes (see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters).

◆ RecordStructuredEvent() [2/2]

static void UGoogleAnalyticsMPStatics::RecordStructuredEvent ( const FString &  EventCategory,
const FString &  EventAction,
const FString &  EventLabel,
const TMap< FString, FString > &  Attributes 
)
inlinestatic

Records an "event" hit type.

Events are user interactions with content other than screen views.

Read more about Google Analytics events here: https://support.google.com/analytics/answer/1033068?hl=en.

Parameters
EventCategoryEvent category (required, it must not be empty).
EventActionEvent action (required, it must not be empty).
EventLabelEvent label (optional, can be empty).
AttributesOptional auxiliary Google Analytics Measurement Protocol attributes (see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters).

◆ RecordStructuredEventWithValue()

static void UGoogleAnalyticsMPStatics::RecordStructuredEventWithValue ( const FString &  EventCategory,
const FString &  EventAction,
const FString &  EventLabel,
const int32  EventValue,
const TMap< FString, FString > &  Attributes 
)
inlinestatic

Records an "event" hit type (with an associated value).

Events are user interactions with content other than screen views.

Read more about Google Analytics events here: https://support.google.com/analytics/answer/1033068?hl=en. To add further custom data to events, read about the Custom Dimensions and Metrics: https://support.google.com/analytics/answer/2709828?hl=en.

Parameters
EventCategoryEvent category (required, it must not be empty).
EventActionEvent action (required, it must not be empty).
EventLabelEvent label (optional, can be empty).
EventValueEvent value (required, use the other RecordEvent* methods if the value must not be logged).
AttributesOptional auxiliary Google Analytics Measurement Protocol attributes (see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters).

◆ ResetPersistentData()

static void UGoogleAnalyticsMPStatics::ResetPersistentData ( )
static

Reset any persistent and cached data.

Call this method to remove any stored data and reset the system to a clean and fresh state. This includes resetting the "opt-out" option (see SetOptOut()), any cached User ID and Client ID, etc.

◆ SetOptOut()

static void UGoogleAnalyticsMPStatics::SetOptOut ( bool  bOptOut)
static

Set if "opt-out" from all analytics logging.

This is a "kill switch" method that can be used to silently ignore all calls made to log events on Google Analytics. It's useful if you want to provide to the user a simple option to opt-out from the analytics. The value is saved in the persistent storage. The default initial value is set in the project settings (see UGoogleAnalyticsMPSettings::bOptOutDefault).

Parameters
bOptOutSet to true to stop sending data to Google Analytics.

◆ SetUserID()

static void UGoogleAnalyticsMPStatics::SetUserID ( const FString &  UserID)
static

Set the know unique identifier of the current user.

The value is saved in the persistent storage accordingly to the setting UGoogleAnalyticsMPSettings::bPersistentUserID.

See also
https://support.google.com/analytics/answer/3123662?hl=en
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uid
Parameters
UserIDThe known identifier for a user, or an empty string to clear it. It must not itself be PII (Personally Identifiable Information). If you have only PII (e.g. the user email address), we suggest to pass a proper hash string of it.

◆ StartSession()

static void UGoogleAnalyticsMPStatics::StartSession ( const TMap< FString, FString > &  Attributes)
static

Start a user session.

If UGoogleAnalyticsMPSettings::bAutoSessionHandling is false, you must call this method when your application starts.


The documentation for this class was generated from the following file: