Skip to content

Commit c1012b4

Browse files
Add information about traits and adding to context for new mobile libraries
1 parent ffd4bab commit c1012b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/connections/spec/common.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ Other libraries only collect `context.library`, any other context variables must
210210

211211
- userAgentData is only collected if the [Client Hints API](https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API){:target="_blank"} is available on the browser.
212212

213+
- Traits are no longer collected and appended to the context of subsequent calls in the new mobile libraries (Swift, Kotlin, and React Native).
214+
213215
To pass the context variables which are not automatically collected by Segment's libraries, you must manually include them in the event payload. The following code shows how to pass `groupId` as the context field of Analytics.js's `.track()` event:
214216

215217
```js
@@ -218,6 +220,11 @@ analytics.track("Report Submitted", {},
218220
);
219221
```
220222

223+
In order to add fields to the context object in the new mobile libraries, you must utilize a custom plugin. Documentation for creating plugins for each library can be found here:
224+
- [React Native](https://segment.com/docs/connections/sources/catalog/libraries/mobile/react-native/#plugin-architecture){:target="_blank"}
225+
- [Swift](https://segment.com/docs/connections/sources/catalog/libraries/mobile/apple/swift-plugin-architecture/){:target="_blank"}
226+
- [Kotlin](https://segment.com/docs/connections/sources/catalog/libraries/mobile/kotlin-android/kotlin-android-plugin-architecture/){:target="_blank"}
227+
221228

222229
## Integrations
223230

0 commit comments

Comments
 (0)