createEventTracker method

Future<CreateEventTrackerResponse> createEventTracker({
  1. required String datasetGroupArn,
  2. required String name,
})

Creates an event tracker that you use when sending event data to the specified dataset group using the PutEvents API.

When Amazon Personalize creates an event tracker, it also creates an event-interactions dataset in the dataset group associated with the event tracker. The event-interactions dataset stores the event data from the PutEvents call. The contents of this dataset are not available to the user. When you send event data you include your tracking ID. The tracking ID identifies the customer and authorizes the customer to send the data.

The event tracker can be in one of the following states:

  • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
  • DELETE PENDING > DELETE IN_PROGRESS
To get the status of the event tracker, call DescribeEventTracker.

Related APIs

May throw InvalidInputException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw ResourceInUseException.

Parameter datasetGroupArn : The Amazon Resource Name (ARN) of the dataset group that receives the event data.

Parameter name : The name for the event tracker.

Implementation

Future<CreateEventTrackerResponse> createEventTracker({
  required String datasetGroupArn,
  required String name,
}) async {
  ArgumentError.checkNotNull(datasetGroupArn, 'datasetGroupArn');
  _s.validateStringLength(
    'datasetGroupArn',
    datasetGroupArn,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    63,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.CreateEventTracker'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'datasetGroupArn': datasetGroupArn,
      'name': name,
    },
  );

  return CreateEventTrackerResponse.fromJson(jsonResponse.body);
}