Event Names

The event_names function provides a useful mechanism to turn each event_name value into a metric sub-column for analysis and comparison, in addition to event and conversion count metrics.

It is derived from the observed values in combination with some additional parameters, which are set via the options JSON variable.

Options

Note that all of these options can be omitted from the options JSON object, which will result in all observed event names being represented as metric sub-columns of the event_count struct.

NAME VALUE Details
include_event_names ARRAY<STRING> A list of event_name values to be spcifically included in the metric columns, regardless of whether the value is observed.
exclude_event_names ARRAY<STRING> A list of event_name values to be specifically excluded from the metric columns. Note that the event rows will still be included.
conversion_events ARRAY<STRING> A list of event_name values which are flagged as conversions.
The default value is ["purchase"].

Examples

Include Events

If there are certain events which you want to be specifically included in the event_name metrics regardless of whether they have been observed, then simply add an array of event_name values to the include_event_names option, in addition to the ga4_dataset_id and gcs_bucket_name required options.

In this example the custom call_booked and form_submitted event_name values are included in the metric sub-columns, regardless of whether they are observed in the data.

{
    "ga4_dataset_id": "project_id.ga4_dataset_id",
    "decode_dataset_id": "project_id.decode_dataset_id",
    "gcs_bucket_name": "your_gcs_bucket_name",
    "include_event_names": ["call_booked", "form_submitted"]
}

If the specified event_name values are not observed, the metric sub-columns be included but will simply sum to zero.

Exclude Events

If there are certain events which you want to be specifically excluded from the event_name metrics, then simply add an array of event_name values to the exclude_event_names option, in addition to the ga4_dataset_id and gcs_bucket_name required options.

In this example the scroll event_name value is excluded.

{
    "ga4_dataset_id": "project_id.ga4_dataset_id",
    "decode_dataset_id": "project_id.decode_dataset_id",
    "gcs_bucket_name": "your_gcs_bucket_name",
    "exclude_event_names": ["scroll"]
}

Note that this does not filter out the rows, it simply excludes these values from the metric sub-columns.

Conversion Events

In order to treat specific event_name values as conversion events, simply add an array of event_name values to the conversion_events option, in addition to the ga4_dataset_id and gcs_bucket_name required options.

In this example the call_booked and form_submitted event_name values are classified as conversions and therefore included in the conversion metric.

{
    "ga4_dataset_id": "project_id.ga4_dataset_id",
    "decode_dataset_id": "project_id.decode_dataset_id",
    "gcs_bucket_name": "your_gcs_bucket_name",
    "conversion_events": ["call_booked", "form_submitted"]
}

Note that purchase will always be included as a conversion by default.

Adding specific conversion_events will not automatically ensure that they are included as metric columns. In order to ensure that the conversion_events values are included as metric sub-columns, they must either be observed in the data or included in the include_event_names option as below.

{
    "ga4_dataset_id": "project_id.ga4_dataset_id",
    "decode_dataset_id": "project_id.decode_dataset_id",
    "gcs_bucket_name": "your_gcs_bucket_name",
    "conversion_events": ["call_booked", "form_submitted"],
    "include_event_names": ["call_booked", "form_submitted"]
}

This will ensure that the metric sub-columns are included, even before they are observed in the data. This is useful for preparing your analytics foundations in expectation of upstream tagging changes.