diff --git a/platform-includes/enriching-events/scopes/configure-scope/native.mdx b/platform-includes/enriching-events/scopes/configure-scope/native.mdx index 4dd8474a84892..365f0f10dd4f0 100644 --- a/platform-includes/enriching-events/scopes/configure-scope/native.mdx +++ b/platform-includes/enriching-events/scopes/configure-scope/native.mdx @@ -5,8 +5,7 @@ The Native SDK maintains all data in a single global scope. sentry_set_tag("my-tag", "my value"); -sentry_value_t user = sentry_value_new_object(); -sentry_value_set_by_key(user, "id", sentry_value_new_int32(42)); -sentry_value_set_by_key(user, "email", sentry_value_new_string("john.doe@example.com")); +// Set a user with id, username, email, and ip_address +sentry_value_t user = sentry_value_new_user("42", "Jane Doe", "jane.doe@example.com", "{{auto}}"); sentry_set_user(user); ``` diff --git a/platform-includes/enriching-events/set-user/native.mdx b/platform-includes/enriching-events/set-user/native.mdx index 2574f2f94b0b7..474ab9d0a9b34 100644 --- a/platform-includes/enriching-events/set-user/native.mdx +++ b/platform-includes/enriching-events/set-user/native.mdx @@ -1,9 +1,10 @@ ```c #include -sentry_value_t user = sentry_value_new_object(); -sentry_value_set_by_key(user, "ip_address", sentry_value_new_string("{{auto}}")); -sentry_value_set_by_key(user, "email", sentry_value_new_string("jane.doe@example.com")); +// Set a user with id, username, email, and ip_address +sentry_value_t user = sentry_value_new_user("42", "Jane Doe", "jane.doe@example.com", "{{auto}}"); +// Set additional custom user data +sentry_value_set_by_key(user, "custom_key", sentry_value_new_string("custom_value")); sentry_set_user(user); ``` diff --git a/platform-includes/sensitive-data/set-user/native.mdx b/platform-includes/sensitive-data/set-user/native.mdx index c4fcbeefb81dd..53e063c50cb4c 100644 --- a/platform-includes/sensitive-data/set-user/native.mdx +++ b/platform-includes/sensitive-data/set-user/native.mdx @@ -1,11 +1,8 @@ -The Native SDK maintains all data in a single global scope. - ```c #include -sentry_value_t user = sentry_value_new_object(); -sentry_value_set_by_key(user, "id", sentry_value_new_int32(client_user->id)); -// OR -sentry_value_set_by_key(user, "username", sentry_value_new_string(client_user->username)); +// At least one parameter must be non-NULL. In this case, the user value will only +// contain the id. username, email, and ip_address will be ignored. +sentry_value_t user = sentry_value_new_user("42", NULL, NULL, NULL); sentry_set_user(user); ```