You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<tdmarkdown="span">*optional if userID is set instead*</td>
3
+
<tdmarkdown="span">*required; optional if `userID` is set instead*</td>
4
4
<tdmarkdown="span">String</td>
5
-
<tdmarkdown="span">A pseudo-unique substitute for a User ID, for cases when you don't have an absolutely unique identifier. A userId or an anonymousId is required.
6
-
5
+
<tdmarkdown="span">A pseudo-unique substitute for a User ID, for cases when you don't have an absolutely unique identifier. A `userId` or an `anonymousId` is required.
6
+
7
7
See the [Identities docs](/docs/connections/spec/identify#identities) for more details.
The Segment HTTP Tracking API lets you record analytics data from any website or application. The requests hit our servers, and we route your data to any destination you want!
6
+
The Segment HTTP Tracking API lets you record analytics data from any website or application. The requests hit Segment servers, Segment routes your data to any destination you want.
7
7
8
-
Segment has native [sources](/docs/connections/sources/) for most use cases (Javascript, iOS, etc.) that are all built for high-performance and are open-source. But sometimes you may want to send to the HTTP API directly—that's what this reference is for.
8
+
Segment has native [sources](/docs/connections/sources/) for most use cases (like JavaScript and iOS) that are all built for high-performance and are open-source. But sometimes you may want to send to the HTTP API directly—that's what this reference is for.
9
9
10
10
## Headers
11
11
12
12
### Authentication
13
13
14
14
Authenticate to the Tracking API by sending your project's **Write Key** along with a request.
15
-
Authentication uses HTTP Basic Auth, which involves a 'username:password' that is base64 encoded and prepended with the string 'Basic '.
15
+
Authentication uses HTTP Basic Auth, which involves a `username:password` that is base64 encoded and prepended with the string `Basic`.
16
16
17
17
In practice that means taking a Segment source **Write Key**,`'abc123'`, as the username, adding a colon, and then the password field is left empty. After base64 encoding `'abc123:'` becomes `'YWJjMTIzOg=='`; and this is passed in the authorization header like so: `'Authorization: Basic YWJjMTIzOg=='`.
18
18
19
19
### Content-Type
20
20
21
-
In order to send data to our HTTP API, a content-type header must be set to `'application/json'`.
21
+
To send data to Segment's HTTP API, a content-type header must be set to `'application/json'`.
22
22
23
23
## Errors
24
24
25
-
We currently return a `200` response for all API requests so debugging should be done in the Segment Debugger. The only exception is if the request is too large / JSON is invalid it will respond with a `400`.
26
-
27
-
We're hard at work surfacing more errors and more helpful responses to our users. If you have any suggestions, [let us know](https://segment.com/help/contact/)!
25
+
Segment returns a `200` response for all API requests so debugging should be done in the Segment Debugger. The only exception is if the request is too large / JSON is invalid it will respond with a `400`.
28
26
27
+
Segment welcomes feedback on API responses and error messages. [Reach out to support](https://segment.com/help/contact/) with any requests or suggestions you may have.
29
28
30
29
## Rate Limits
31
30
32
-
There is no hard rate limit at which point Segment will drop your data. We ask that if you need to import at a rate exceeding 500 requests per second, [contact us](https://segment.com/help/contact/) first. Requests include batches sent with the [batch method](#batch), which means you can send a large batch of events inside of a single request.
31
+
There is no hard rate limit at which point Segment will drop your data. [Contact support](https://segment.com/help/contact/)if you need to import at a rate exceeding 500 requests per second. Requests include batches sent with the [batch method](#batch), which means you can send a large batch of events inside of a single request.
33
32
34
33
## Max Request Size
35
34
@@ -39,7 +38,7 @@ There is a maximum of `32KB` per normal API request. The `batch` API endpoint a
39
38
40
39
`identify` lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them.
41
40
42
-
We recommend calling `identify` a single time when the user's account is first created, and only identifying again later when their traits change.
41
+
Segment recommends calling `identify` a single time when the user's account is first created, and only identifying again later when their traits change.
43
42
44
43
Example `identify` call:
45
44
@@ -71,15 +70,15 @@ This call is identifying the user by their unique User ID (the one you know them
71
70
{% include content/spec-field-user-id.md %}
72
71
</table>
73
72
74
-
Find details on the **identify method payload** in our [Spec](/docs/connections/spec/identify/).
73
+
Find details on the **identify method payload** in the [Segment Spec](/docs/connections/spec/identify/).
75
74
76
75
## Track
77
76
78
-
`track` lets you record the actions your users perform. Every action triggers what we call an "event", which can also have associated properties.
77
+
`track` lets you record the actions your users perform. Every action triggers an "event", which can also have associated properties.
79
78
80
79
You'll want to track events that are indicators of success for your site, like **Signed Up**, **Item Purchased** or **Article Bookmarked**.
81
80
82
-
To get started, we recommend tracking just a few important events. You can always add more later!
81
+
To get started, try tracking just a few important events. You can always add more later.
83
82
84
83
Example `track` call:
85
84
@@ -254,7 +253,7 @@ For more details on the `alias` call and payload, check out our [Spec](/docs/con
254
253
255
254
You can import historical data by adding the `timestamp` argument to any of your method calls. This can be helpful if you've just switched to Segment.
256
255
257
-
Historical imports can only be done into destinations that can accept historical timestamped data. Most analytics tools like Mixpanel, Amplitude, Kissmetrics, etc. can handle that type of data just fine. One common destination that does not accept historical data is Google Analytics since their API cannot accept historical data.
256
+
Historical imports can only be done into destinations that can accept historical timestamped data. Most analytics tools like Mixpanel, Amplitude, and Kissmetrics can handle that type of data just fine. One common destination that does not accept historical data is Google Analytics since their API cannot accept historical data.
258
257
259
258
**Note:** If you're tracking things that are happening right now, leave out the `timestamp` and our servers will timestamp the requests for you.
260
259
@@ -377,13 +376,13 @@ POST https://api.segment.io/v1/identify
377
376
}
378
377
```
379
378
380
-
In this case, we're specifying that we want this identify to only go to Mixpanel and Kissmetrics. `'All': false` says that no destination should be enabled unless otherwise specified. `'Mixpanel': true` turns on Mixpanel, etc.
379
+
`'All': false` says that no destination should be enabled unless otherwise specified. `'Mixpanel': true` turns on Mixpanel, `"Kissmetrics": true,` turns on Kissmetrics, and so on.
381
380
382
-
Destination flags are **case sensitive** and match [the destination's name in the docs](/docs/connections/destinations/catalog/) (i.e. "AdLearn Open Platform", "awe.sm", "MailChimp", etc.).
381
+
Destination flags are **case sensitive** and match [the destination's name in the docs](/docs/connections/destinations/catalog/) (i.e. "AdLearn Open Platform", "awe.sm", "MailChimp", and so on).
383
382
384
383
**Note:**
385
384
386
-
- Available at the business level, filtering track calls can be done right from the Segment UI on your source schema page. We recommend using the UI if possible since it's a much simpler way of managing your filters and can be updated with no code changes on your side.
385
+
- Available at the business level, filtering track calls can be done right from the Segment UI on your source schema page. Segment recommends using the UI if possible since it's a much simpler way of managing your filters and can be updated with no code changes on your side.
387
386
388
387
- If you are on a grandfathered plan, events sent server-side that are filtered through the Segment dashboard will still count towards your API usage.
389
388
@@ -401,6 +400,6 @@ When sending a HTTP call from a user's device, you can collect the IP address by
401
400
402
401
1. Double check that you've set up the library correctly.
403
402
404
-
2. Make sure that you're calling one of our API methods once the library is successfully installed—[`identify`](#identify), [`track`](#track), etc.
403
+
2. Make sure that you're calling one of our API methods once the library is successfully installed—[`identify`](#identify), [`track`](#track), and so on.
405
404
406
405
{% include content/troubleshooting-server-integration.md %}
Copy file name to clipboardExpand all lines: src/connections/spec/identify.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ Here's the payload of a typical `identify` call with most [common fields](/docs/
38
38
}
39
39
```
40
40
41
-
And here's the corresponding Javascript event that would generate the above payload:
41
+
And here's the corresponding JavaScript event that would generate the above payload:
42
42
43
43
```js
44
44
analytics.identify("97980cfea0067", {
@@ -113,7 +113,7 @@ The Anonymous ID can be any pseudo-unique identifier. For example, on your serve
113
113
114
114
**Note:** Our [browser and mobile libraries](/docs/connections/sources/)**automatically** use Anonymous IDs under the covers to keep track of users as they navigate around your website or app, so you don't need to worry about them when using those libraries.
115
115
116
-
Here's an example of a Javascript event for an anonymous user:
116
+
Here's an example of a JavaScript event for an anonymous user:
**Note:** You might be used to some destinations recognizing special traits by slightly different names. For example, Mixpanel recognizes a `$created` trait when the user's account was first created, while Intercom recognizes the same trait as `created_at` instead. Luckily, you don't have to worry about those inconsistencies. Just pass us `createdAt`. **We'll handle all of the destination-specific conversions for you automatically.** Same goes for the rest of the reserved traits.
240
240
241
-
**You can pass these reserved traits using camelCase or snake_case**, so in Javascript you can match the rest of your camel-case code by sending `firstName`, while in Ruby you can match your snake-case code by sending `first_name`. That way the API never seems alien to your code base. Keep in mind that not all destinations support these reserved traits, so sending these traits in camelCase and snake_case can result in two sets of traits in other destinations.
241
+
**You can pass these reserved traits using camelCase or snake_case**, so in JavaScript you can match the rest of your camel-case code by sending `firstName`, while in Ruby you can match your snake-case code by sending `first_name`. That way the API never seems alien to your code base. Keep in mind that not all destinations support these reserved traits, so sending these traits in camelCase and snake_case can result in two sets of traits in other destinations.
0 commit comments