Google Analytics Measurement Protocol  1.1.1
Google Analytics plugin for Unreal Engine, using a native cross-platform implementation of the Measurement Protocol.
Event Attributes Filter

Event Attributes Filter

The plugin supports a custom filter to freely manipulate the attributes logged with each reported event. With the filter, you can add, delete and change values of any logged attribute.

A custom filter is a commonly used when you want to inject custom attributes (e.g. Custom Dimensions and Metrics) or when you need to override the value of standard attributes.

Configuration

To configure a custom attributes filter class:

  1. create a custom class inheriting from UGoogleAnalyticsMPAttributesFilter. You can do it in C++ or Blueprints.
  2. Open Project Settings > Google Analytics MP and configure the Attributes Filter Class option:

    filter-settings.png
    Configuring the Attributes Filter Class option
  3. Override the implementation method as described below.

Blueprint implementation

Override the method named FilterAttributesImpl. For example:

filter-blueprint.png
Overriding FilterAttributesImpl in Blueprints

Check method documentation at UGoogleAnalyticsMPAttributesFilter::FilterAttributesImpl().

C++ implementation

Override the method UGoogleAnalyticsMPAttributesFilter::FilterAttributesImpl_Implementation():

bool UTestCPPAttributesFilter::FilterAttributesImpl_Implementation(
const FString & EventName,
TMap<FString, FString> & Attributes
)
{
// Set a predefined label on specif events.
if (EventName == TEXT("SpecialEvent"))
{
Attributes.Emplace(TEXT("el"), TEXT("SpecialLabel"));
return true;
}
return false;
}

Check method documentation at UGoogleAnalyticsMPAttributesFilter::FilterAttributesImpl().

Customize the filter at runtime

Your filter class can use properties that you can set at run-time. The used filter instance can be retrieved calling UGoogleAnalyticsMPStatics::GetAttributesFilter().

If you need to set some values for all the events sent during a session (including the very first event that starts the user session), you must: