Google Analytics Measurement Protocol 1.2.0
Google Analytics plugin for Unreal Engine, using a native cross-platform implementation of the Measurement Protocol.
No Matches
Log Custom Events to GA4

Log Custom Events to GA4

You can easily record custom events using the plugin method UGoogleAnalyticsMPStatics::RecordNamedEvent():

RecordNamedEvent method

Attention: GA4 has strict naming rules and reserved event names (read more), we suggest to use a unique common safe prefix for your custom event names.

Use Custom Parameters

To be able to log custom parameters with your events, Google Analytics 4 requires you to explicitly register them in advance. You can find detailed instructions on how to register a custom parameter here: Custom Dimensions and Metrics.

Once the parameters are registered with their event parameter names, using them is very simple:

RecordNamedEvent method with custom parameters

You must only remember to add, to the registered event parameter names, the correct prefix:

  • ep for Custom Dimensions (Event Parameter);
  • epn for Custom Metrics (Event Parameter Numeric).

In the example above:

  • the registered parameter test_event_label is a Custom Dimension, and so it uses the prefix ep;
  • the registered parameter test_event_value is a Custom Metric, and so it uses the prefix epn;

Further reading