Skip to main content
The EventGroups service provides methods for managing event group resources, which represent groupings of events defined by data providers.

Resource

EventGroup

A grouping of events defined by a DataProvider. For example, a single campaign or creative defined in a publisher’s ad system. Resource name patterns:
  • dataProviders/{data_provider}/eventGroups/{event_group} (canonical)
  • measurementConsumers/{measurement_consumer}/eventGroups/{event_group}
name
string
required
Resource name identifier.
measurement_consumer
string
required
Resource name of the MeasurementConsumer associated with this EventGroup. Required, immutable.
event_group_reference_id
string
ID referencing the EventGroup in an external system, provided by the DataProvider. This value should be used to help the DataProvider synchronize their metadata with the EventGroupsService.
media_types
MediaType[]
required
The MediaTypes of the events entailed by this EventGroup. These are used to derive the EventTemplates that the events associated with this EventGroup conform to.
event_group_metadata
EventGroupMetadata
required
Metadata that describes the events entailed by the EventGroup.
event_templates
EventTemplate[]
deprecated
The EventTemplates that events associated with this EventGroup conform to.In a future release, this field will be deprecated in favor of setting media_types, but should continue to be set alongside media_types until it is formally marked deprecated. It will be deprecated no sooner than the Halo CMM 0.6 release.
encrypted_metadata
EncryptedMessage
deprecated
Metadata encrypted using the measurement_consumer_public_key as the recipient public key.The version of the Metadata message type must match the API version used to last update this resource.In a future release this field will be deprecated and replaced by event_group_metadata but until this field is marked deprecated it should continue to be written alongside event_group_metadata. It will be deprecated no sooner than the Halo CMM 0.6 release.
measurement_consumer_public_key
Any
deprecated
Pre-shared packed EncryptionPublicKey. Must be set if encrypted_metadata is set.The version of the EncryptionPublicKey message must match the API version used to last update this resource.This field will be deprecated in a future release. See encrypted_metadata for additional information.
state
State
Event Group state. Output only.Possible values:
  • STATE_UNSPECIFIED - The default value if state is omitted. Should not be used.
  • ACTIVE - The Event Group has been created
  • DELETED - The Event Group has been deleted. An Event Group in a DELETED state will have all mutable optional fields cleared. This state is terminal.
data_availability_interval
Interval
required
Interval for which this EventGroup has events.When this field is specified, start_time is required. If end_time is not specified, the interval is considered unbounded.If this EventGroup represents an ad campaign, this is typically the start and end times of the campaign.
aggregated_activities
AggregatedActivity[]
A summary of EventGroupActivity resources for this EventGroup.Only set when the view is WITH_ACTIVITY_SUMMARY. Output only.

EventTemplate

Template for an event message.
type
string
required
The type of the Event Template. A fully-qualified protobuf message type.

AggregatedActivity

Aggregated EventGroupActivity for a contiguous date interval.
interval
DateInterval
Aggregated interval.

View Enum

View of an EventGroup.
  • VIEW_UNSPECIFIED - The default/unset value. The API will default to the BASIC view unless otherwise specified by the method.
  • BASIC - Basic view
  • WITH_ACTIVITY_SUMMARY - View with activity summary

Methods

GetEventGroup

Returns the EventGroup with the specified resource key. Request
name
string
required
Resource name of the EventGroup.Format: dataProviders/{data_provider}/eventGroups/{event_group}
view
View
The view of EventGroup to return. Defaults to BASIC.
Response Returns an EventGroup resource. Example
message GetEventGroupRequest {
  string name = 1 [(google.api.field_behavior) = REQUIRED];
  EventGroup.View view = 2;
}

CreateEventGroup

Creates (registers) a EventGroup defined in the specified DataProvider’s system. Request
parent
string
required
Resource name of the parent DataProvider.Format: dataProviders/{data_provider}
event_group
EventGroup
required
The EventGroup to create.The name field will be ignored, and the system will assign an ID.Required fields:
  • measurement_consumer: Resource name of the associated MeasurementConsumer
  • media_types: MediaTypes of the events
  • event_group_metadata: Metadata describing the events
  • data_availability_interval: Interval for which events are available
request_id
string
Unique identifier for this request. If specified, the request will be idempotent. See https://google.aip.dev/155.
Response Returns the created EventGroup resource. Example
message CreateEventGroupRequest {
  string parent = 1 [(google.api.field_behavior) = REQUIRED];
  EventGroup event_group = 2 [(google.api.field_behavior) = REQUIRED];
  string request_id = 3;
}

BatchCreateEventGroups

Batch creates EventGroups. Results in an error if any of the specified EventGroups fail to be created. Request
parent
string
required
Resource name of the parent DataProvider.Format: dataProviders/{data_provider}
requests
CreateEventGroupRequest[]
required
The requests specifying the EventGroups to create. Either all requests must have the same parent and the parent must match the top-level parent, or all requests must leave the parent unset.A maximum of 50 EventGroups can be created in a single batch.
Response
event_groups
EventGroup[]
The EventGroup resources.
Example
message BatchCreateEventGroupsRequest {
  string parent = 1 [(google.api.field_behavior) = REQUIRED];
  repeated CreateEventGroupRequest requests = 2 [(google.api.field_behavior) = REQUIRED];
}

message BatchCreateEventGroupsResponse {
  repeated EventGroup event_groups = 1;
}

UpdateEventGroup

Updates an existing EventGroup. Results in a PERMISSION_DENIED error if the authenticated user does not have access to the EventGroup. Results in a NOT_FOUND error if the specified EventGroup does not exist. Request
event_group
EventGroup
required
The EventGroup to update. The name field is used to identify the resource to update.Note: This is a full replacement update, not a partial update.
Response Returns the updated EventGroup resource. Example
message UpdateEventGroupRequest {
  EventGroup event_group = 1 [(google.api.field_behavior) = REQUIRED];
}
Usage Notes
  • This performs a full replacement update.
  • Partial updates are not supported.
  • The name field identifies which EventGroup to update.
  • Immutable fields cannot be changed.

BatchUpdateEventGroups

Batch updates EventGroups. Results in an error if any of the specified EventGroups fail to be updated. Request
parent
string
required
Resource name of the parent DataProvider.Format: dataProviders/{data_provider}
requests
UpdateEventGroupRequest[]
required
The requests specifying the EventGroups to update. Either all requests must have the same parent and the parent must match the top-level parent, or all requests must leave the parent unset.A maximum of 50 EventGroups can be updated in a single batch.
Response
event_groups
EventGroup[]
The EventGroup resources.
Example
message BatchUpdateEventGroupsRequest {
  string parent = 1 [(google.api.field_behavior) = REQUIRED];
  repeated UpdateEventGroupRequest requests = 2 [(google.api.field_behavior) = REQUIRED];
}

message BatchUpdateEventGroupsResponse {
  repeated EventGroup event_groups = 1;
}

DeleteEventGroup

Deletes an existing EventGroup. EventGroup will transition to a DELETED state and will have all of its mutable optional fields cleared. This action is irreversible. Results in a PERMISSION_DENIED error if the authenticated user does not have access to the EventGroup. Results in a NOT_FOUND error if the specified EventGroup does not exist. Request
name
string
required
Resource name of the EventGroup to delete.Format: dataProviders/{data_provider}/eventGroups/{event_group}
Response Returns the deleted EventGroup resource with state set to DELETED and mutable optional fields cleared. Example
message DeleteEventGroupRequest {
  string name = 1 [(google.api.field_behavior) = REQUIRED];
}
Important Notes
  • Deletion is irreversible.
  • The EventGroup transitions to DELETED state (terminal).
  • All mutable optional fields are cleared.
  • The resource remains visible but cannot be used in new measurements.

ListEventGroups

Lists EventGroups. Results in a PERMISSION_DENIED error if attempting to list EventGroups that the authenticated user does not have access to. Request
parent
string
required
Resource name of the parent.Format: dataProviders/{data_provider}
page_size
int32
The maximum number of resources to return. The service may return fewer than this value.If unspecified, at most 10 resources will be returned. The maximum value is 500; values above this will be coerced to the maximum.
page_token
string
A token from a previous call, specified to retrieve the next page. See https://aip.dev/158.
filter
Filter
Filter criteria for this request.
show_deleted
bool
Whether to include EventGroups in the DELETED state. Defaults to false.
order_by
OrderBy
How results should be ordered.
view
View
The view of EventGroup to return. Defaults to BASIC.
Response
event_groups
EventGroup[]
The EventGroup resources.
next_page_token
string
A token that can be specified in a subsequent call to retrieve the next page. See https://aip.dev/158.
Example
message ListEventGroupsRequest {
  string parent = 1 [(google.api.field_behavior) = REQUIRED];
  int32 page_size = 2;
  string page_token = 3;
  Filter filter = 4;
  bool show_deleted = 5;
  OrderBy order_by = 6;
  EventGroup.View view = 7;
}

message ListEventGroupsResponse {
  repeated EventGroup event_groups = 1;
  string next_page_token = 2;
}

Workflow

Creating Event Groups

  1. Identify Event Source: Determine which campaign or data source the EventGroup represents.
  2. Prepare Metadata: Collect metadata about the events (campaign info, creative details, etc.).
  3. Set Media Types: Specify which MediaTypes the events conform to.
  4. Define Availability: Set the data_availability_interval for when events are available.
  5. Associate Consumer: Specify which MeasurementConsumer this EventGroup is shared with.
  6. Create Resource: Call CreateEventGroup or BatchCreateEventGroups.

Updating Event Groups

  1. Retrieve Current State: Use GetEventGroup to get the current EventGroup.
  2. Modify Fields: Update the fields you want to change.
  3. Submit Update: Call UpdateEventGroup with the complete updated resource.
  4. Verify Changes: Optionally call GetEventGroup again to confirm the update.

Deleting Event Groups

  1. Identify EventGroup: Determine which EventGroup to delete.
  2. Call Delete: Use DeleteEventGroup.
  3. Confirm Deletion: The EventGroup will be in DELETED state.
  4. Note: Deletion is permanent and cannot be reversed.

Listing and Filtering

  1. Basic Listing: Call ListEventGroups with just a parent to get all EventGroups.
  2. Filter by Consumer: Use filter.measurement_consumer_in to find EventGroups for specific consumers.
  3. Filter by Date: Use data availability filters to find EventGroups for specific time periods.
  4. Search Metadata: Use filter.metadata_search_query to search within metadata.
  5. Include Deleted: Set show_deleted = true to include deleted EventGroups.
  6. Order Results: Use order_by to sort by data availability start time.

Best Practices

Data Availability Intervals

  • Start Time: Always required. Set to when the first event occurred.
  • End Time: Optional. Omit for ongoing campaigns (unbounded interval).
  • Accuracy: Only specify intervals where you actually have event data.
  • Updates: Update the interval as campaigns progress or end.

Metadata Management

  • Completeness: Provide comprehensive metadata to enable accurate filtering and search.
  • Consistency: Use consistent naming and formatting across EventGroups.
  • Updates: Keep metadata current as campaign details change.
  • Privacy: Ensure metadata doesn’t contain sensitive information.

Batch Operations

  • Efficiency: Use batch operations when creating or updating multiple EventGroups.
  • Limits: Respect the 50 EventGroup limit per batch.
  • Error Handling: If any operation fails, the entire batch fails.
  • Atomicity: All operations in a batch succeed or all fail together.

State Management

  • Active State: Normal operational state for EventGroups.
  • Deletion: Only delete EventGroups when they should never be used again.
  • Immutability: Some fields like measurement_consumer cannot be changed after creation.
  • Views: Use appropriate views (BASIC vs WITH_ACTIVITY_SUMMARY) based on your needs.

Build docs developers (and LLMs) love