---
schema_version: "1"
id: c89fad8d24ee96ee4b903b79de6663c4239bb98946760682737f9ac704acc235
title: trackEvent
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud-mobilepush/engagement_sdk/references/flutter/flutter_trackEvent.md
canonical_url: https://developer.salesforce.com/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/flutter_trackEvent.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 31509fbe6b3e691e927bc0978215728093ca2c60c5be050ba4f598c555cf5208
products:
  - Salesforce Engagement SDK
---
# trackEvent

Tracks a custom event for analytics purposes.

## Syntax

```dart
Future<void> trackEvent(Map<String, dynamic> event)
```

## Parameters

- `event` (Map<String, dynamic>) - The event data to track

## Returns

- `Future<void>` - Completes when the event has been tracked.

## Example

```dart
try {
  await SfmcSdk.trackEvent({
    'eventName': 'purchase',
    'amount': 29.99,
    'currency': 'USD',
    'productId': 'prod123'
  });
  print('Event tracked successfully');
} catch (e) {
  print('Failed to track event: $e');
}
```

## Notes

- Events are used for analytics and can trigger journey builder activities.
- Event data should be structured as key-value pairs.
