Skip to content

Commit f6425da

Browse files
Merge pull request #4416 from segmentio/joeynmq-patch-2
Add sample code to pass custom field in context
2 parents 0f66615 + 958e681 commit f6425da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/connections/spec/common.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ Other libraries only collect `context.library`, any other context variables must
185185
- IP Address isn't collected by Segment's libraries, but is instead filled in by Segment's servers when it receives a message for **client side events only**.
186186
- The Android library collects `screen.density` with [this method](/docs/connections/spec/common/#context-fields-automatically-collected).
187187

188+
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:
189+
190+
```js
191+
analytics.track("Report Submitted", {},
192+
{"groupId": "1234"}
193+
);
194+
```
195+
196+
188197
## Integrations
189198

190199
A dictionary of destination names that the message should be sent to. `'All'` is a special key that applies when no key for a specific destination is found.

0 commit comments

Comments
 (0)