setContactKey

Sets the contact key for the device to associate it with a specific contact in Marketing Cloud.

Syntax

Future<void> setContactKey(String contactKey)

Parameters

  • contactKey (String) - The unique identifier for the contact

Returns

  • Future<void> - Completes when the contact key has been set.

Example

try {
  await SfmcSdk.setContactKey('user123@example.com');
  print('Contact key set successfully');
} catch (e) {
  print('Failed to set contact key: $e');
}

Related Methods