Google Analytics Measurement Protocol 1.2.2
Google Analytics plugin for Unreal Engine, using a native cross-platform implementation of the Measurement Protocol.
Loading...
Searching...
No Matches
Event Attributes Filter for GA4

Event Attributes Filter for GA4

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 the Plugin Settings and configure the Attributes Filter Class option:

    Configuring the Attributes Filter Class option

  3. Override the implementation method as described below. Ensure to read Use Custom Parameters to work with custom parameters.

Blueprint implementation

Override the method named FilterAttributesImpl. For example:

Overriding FilterAttributesImpl in Blueprints

Check method documentation at UGoogleAnalyticsMPAttributesFilter::FilterAttributesImpl().

C++ implementation

Override the method FilterAttributesImpl_Implementation():

bool UTestCPPAttributesFilter::FilterAttributesImpl_Implementation(
const FString & EventName,
TMap<FString, FString> & Attributes
)
{
// Set a predefined label on specific events.
if (EventName == TEXT("page_view"))
{
Attributes.Emplace(TEXT("ep.test_event_label"), TEXT("My filter"));
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: