createEventTracker method

Future<CreateEventTrackerResponse> createEventTracker({
  1. required String datasetGroupArn,
  2. required String name,
  3. List<Tag>? tags,
})

Creates an event tracker that you use when adding event data to a specified dataset group using the PutEvents API. When you create an event tracker, the response includes a tracking ID, which you pass as a parameter when you use the PutEvents operation. Amazon Personalize then appends the event data to the Item interactions dataset of the dataset group you specify in your event tracker.

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 LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw TooManyTagsException.

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

Parameter name : The name for the event tracker.

Parameter tags : A list of tags to apply to the event tracker.

Implementation

Future<CreateEventTrackerResponse> createEventTracker({
  required String datasetGroupArn,
  required String name,
  List<Tag>? tags,
}) async {
  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,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateEventTrackerResponse.fromJson(jsonResponse.body);
}