Skip to content

Commit 4a1ed27

Browse files
authored
Common fixes more (#450)
* Fixes tables and removes paragraph markers that mixed markdown and html * Additional fixery
1 parent 5d6a3c1 commit 4a1ed27

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

src/connections/spec/common.md

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: 'Spec: Common Fields'
44

55
In the Segment [Spec](/docs/connections/spec/) all the [API calls](/docs/connections/spec#api-calls) have a common structure, and a few common fields.
66

7-
However, not all destinations accept all fields included in the Spec. Not sure which fields an destination accepts? Refer to the destination's documentation page, or check out the [open-source destination code on Github](https://github.com/segment-integrations).
7+
However, not all destinations accept all fields included in the Spec. Not sure which fields a destination accepts? Refer to the destination's documentation page, or check out the [open-source destination code on Github](https://github.com/segment-integrations).
88

99
## Structure
1010
Every API call has the same core structure and fields. These fields describe user identity, timestamping and mechanical aides like API version.
@@ -129,23 +129,23 @@ Context is a dictionary of extra information that provides useful context about
129129
<td>`active`</td>
130130
<td>Boolean</td>
131131
<td>Whether a user is active
132-
132+
<br><br>
133133
This is usually used to flag an `.identify()` call to just update the traits but not "last seen."
134134
</td>
135135
</tr>
136136
<tr>
137137
<td>`app`</td>
138138
<td>Object</td>
139139
<td>dictionary of information about the current application, containing `name`, `version` and `build`.
140-
140+
<br><br>
141141
This is collected automatically from our mobile libraries when possible.
142142
</td>
143143
</tr>
144144
<tr>
145145
<td>`campaign`</td>
146146
<td>Object</td>
147147
<td>Dictionary of information about the campaign that resulted in the API call, containing `name`, `source`, `medium`, `term` and `content`.
148-
148+
<br><br>
149149
This maps directly to the common UTM campaign parameters.
150150
</td>
151151
</tr>
@@ -187,9 +187,7 @@ Context is a dictionary of extra information that provides useful context about
187187
<tr>
188188
<td>`page`</td>
189189
<td>Object</td>
190-
<td>Dictionary of information about the current page in the browser, containing `hash`, `path`, `referrer`, `search`, `title` and `url`
191-
192-
Automatically collected by Analytics.js.
190+
<td>Dictionary of information about the current page in the browser, containing `hash`, `path`, `referrer`, `search`, `title` and `url`. This is automatically collected by Analytics.js.
193191
</td>
194192
</tr>
195193
<tr>
@@ -212,14 +210,14 @@ Context is a dictionary of extra information that provides useful context about
212210
<td>`groupId`</td>
213211
<td>String</td>
214212
<td>Group / Account ID.
215-
213+
<br><br>
216214
This is useful in B2B use cases where you need to attribute your non-group calls to a company or account. It is relied on by several Customer Success and CRM tools.</td>
217215
</tr>
218216
<tr>
219217
<td>`traits`</td>
220218
<td>Object</td>
221219
<td>Dictionary of `traits` of the current user
222-
220+
<br><br>
223221
This is useful in cases where you need to `track` an event, but also associate information from a previous `identify` call. You should fill this object the same way you would fill traits in an [identify call](/docs/connections/spec/identify/#traits).</td>
224222
</tr>
225223
<tr>
@@ -307,63 +305,59 @@ Every API call has four timestamps, `originalTimestamp`, `timestamp`, `sentAt` a
307305
### Timestamp Overview
308306

309307
<table>
310-
<col width="20%">
311-
<col width="40%">
312-
<col width="40%">
313308
<tr>
314309
<td>**Timestamp**</td>
315310
<td>**Calculated**</td>
316311
<td>**Description**</td>
317312
</tr>
318313
<tr>
319-
<td>originalTimestamp</td>
314+
<td>`originalTimestamp`</td>
320315
<td>
321316
Time on the client device when call was invoked
322-
317+
<br>
323318
**OR**
324-
319+
<br>
325320
The `timestamp` value manually passed in through server-side libraries.
326321
</td>
327322
<td>
328323
Used by Segment to calculate `timestamp`.
329-
330-
**Note:** `originalTimestamp` is not useful for analysis since it's not always trustworthy as it can be easily adjusted and affected by clock skew.
331-
</td>
324+
<br><br>
325+
**Note:** `originalTimestamp` is not useful for analysis since it's not always trustworthy as it can be easily adjusted and affected by clock skew.</td>
332326
</tr>
333327
<tr>
334-
<td>sentAt</td>
328+
<td>`sentAt`</td>
335329
<td>
336330
Time on client device when call was sent
337-
331+
<br>
338332
**OR**
339-
340-
`sentAt` value manually passed in.
333+
<br>
334+
`sentAt` value manually passed in.
341335
</td>
342336
<td>
343337
Used by Segment to calculate `timestamp`.
344-
345-
**Note:** `sentAt` is not useful for analysis since it's not always trustworthy as it can be easily adjusted and affected by clock skew</p>
338+
<br><br>
339+
**Note:** `sentAt` is not useful for analysis since it's not always trustworthy as it can be easily adjusted and affected by clock skew.
346340
</td>
347341
</tr>
348342
<tr>
349-
<td>receivedAt</td>
343+
<td>`receivedAt`</td>
350344
<td>time on Segment server clock when call was received</td>
351345
<td>
352346
Used by Segment to calculate `timestamp`, and used as sort key in Warehouses.
353-
347+
<br><br>
354348
**Note:** For max query speed, `receivedAt` is the recommended timestamp for analysis when chronology does not matter as chronology is not ensured.
355349
</td>
356350
</tr>
357351
<tr>
358-
<td>timestamp</td>
352+
<td>`timestamp`</td>
359353
<td>
360354
Calculated by Segment to correct client-device clock skew using the following formula:
361-
355+
<br>
362356
`receivedAt` - (`sentAt` - `originalTimestamp`)
363357
</td>
364358
<td>
365359
Used by Segment to send to downstream destinations, and used for historical replays.
366-
360+
<br><br>
367361
**Note:** Recommended timestamp for analysis when chronology does matter.
368362
</td>
369363
</tr>
@@ -377,7 +371,7 @@ The `originalTimestamp` tells you when call was invoked on the client device or
377371
**Note:** The `originalTimestamp` timestamp is not useful for any analysis since it's not always trustworthy as it can be easily adjusted and affected by clock skew.
378372

379373

380-
### `sentAt`
374+
### sentAt
381375

382376
The `sentAt` timestamp specifies the clock time for the client's device when the network request was made to the Segment API. For libraries and systems that send batched requests, there can be a long gap between a datapoint's `timestamp` and `sentAt`. Combined with `receivedAt`, we can use `sentAt` to correct the original `timestamp` in situations where a user's device clock cannot be trusted (mobile phones and browsers). The `sentAt` and `receivedAt` timestamps are assumed to occur at the same time (maximum a few hundred milliseconds), and therefore the difference is the user's device clock skew, which can be applied back to correct the `timestamp`.
383377

0 commit comments

Comments
 (0)