groupIdentify method

Future<void> groupIdentify(
  1. String groupType,
  2. String groupName,
  3. Identify identify, [
  4. EventOptions? options,
])

Updates the properties of particular groups.

This feature is available in accounts with a Growth or Enterprise plan with the Accounts add-on.

Note that this will only affect future events, and don't update historical events.

Accepts a groupType, a groupName, an identify object that's applied to the group, and an optional eventOptions

Example: if you wanted to set a key-value pair as a group property to the enterprise group with group type to be plan, you would do:

final groupIdentifyEvent = Identify()
  ..set('key1', 'value1');
amplitude.groupIdentify('plan', 'enterprise', identify);

Implementation

Future<void> groupIdentify(
    String groupType, String groupName, Identify identify,
    [EventOptions? options]) async {
  final event = GroupIdentifyEvent();
  final group = <String, dynamic>{};
  group[groupType] = groupName;
  event.groups = group;
  event.groupProperties = identify.properties;
  if (options != null) {
    event.mergeEventOptions(options);
  }

  return await _channel.invokeMethod('groupIdentify',
      {'instanceName': configuration.instanceName, 'event': event.toMap()});
}