setContactKey

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

Syntax 

1Future<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 

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

Related Methods 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!