Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/connections/destination-data-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ An `integrations object` may be passed in the `options` of  `group`, `identify`
All customers can filter specific events from being sent to specific Destinations (except for warehouses) by updating their tracking code. Here is an example showing how to send a single message only to Intercom and Google Analytics:

```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu',
type: 'electric'
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'All': false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ Each endpoint *always* responds with a `200 <empty-gif>`, even if an error occur
```json
{
"writeKey": "YOUR_WRITE_KEY",
"userId": "025pikachu025",
"userId": "user_123",
"event": "Email Opened",
"properties": {
"subject": "The Electric Daily",
"email": "peekAtMe@email.poke"
"email": "jane.kim@example.com"
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ This is an advanced method, but it is required to manage user identities success

`alias` method definition:

```
```js
analytics.alias(userId, [previousId], [options], [callback]);
```
The `alias` call has the following fields:
Expand Down Expand Up @@ -374,9 +374,8 @@ Here are the query parameters to use:

So for example, this URL:

```
```text
http://segment.com/?ajs_uid=123456789abcd&ajs_event=Clicked%20Email&ajs_aid=abc123&ajs_prop_emailCampaign=First+Touch&ajs_trait_name=Karl+Jr.

```

it would trigger the following events on the page:
Expand All @@ -397,10 +396,9 @@ An `integrations` object may be passed in the `options` of `alias`, `group`, `id
An example showing how to send a single message only to Intercom and Google Analytics:

```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu',
type: 'electric'
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'All': false,
Expand All @@ -415,10 +413,9 @@ analytics.identify('025pikachu025', {
Conversely, an example how to send a single message to all integrations **except** Intercom and Google Analytics:

```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu',
type: 'electric'
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'Intercom': false,
Expand Down Expand Up @@ -449,7 +446,7 @@ This way, you can conditionally load integrations based on what customers opt in

A pseudocode example:

```
```js
onConsentDialogClosed(function(consentedTools){
analytics.load('writekey', { integrations: consentedTools })
})
Expand Down Expand Up @@ -539,8 +536,8 @@ analytics.user().anonymousId('ABC-123-XYZ');
Or in the `options` object of [`identify`](/docs/connections/spec/identify), [`page`](/docs/connections/spec/page), or [`track`](/docs/connections/spec/track) calls, like this:

```js
analytics.identify('025pikachu025', {
name: 'Pikachu'
analytics.identify('user_123', {
name: 'Jane Kim'
}, {
anonymousId: 'ABC-123-XYZ'
});
Expand Down Expand Up @@ -765,7 +762,7 @@ Within the `options` dictionary, a sub-dictionary, `context`, exists. The contex

Consider this identify event:

```
```js
analytics.identify('12091906-01011992', {
plan_id: 'Paid, Tier 2'
email: 'grace@usnavy.gov'
Expand All @@ -774,7 +771,7 @@ analytics.identify('12091906-01011992', {

The traits on this event are `plan_id`. If you want these traits to appear on a subsequent track or page event that this user triggers, you can get this association by passing those traits into `context.traits` as follows:

```
```js
analytics.track('Clicked Email', {
emailCampaign: 'First Touch'
},
Expand Down Expand Up @@ -901,7 +898,7 @@ There should be no noticeable impact to your data flow. You may notice analytics
### How are properties with `null` and `undefined` values treated?
We use the [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) method under the hood. Property values set to `null` or `undefined` are treated in accordance with the expected behaviour for the standard method:

```
```js
console.log(JSON.stringify({ x: null, y: 6 }));
// expected output: "{"x":null,"y":6}"

Expand Down
6 changes: 3 additions & 3 deletions src/connections/sources/index-tonik.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ You can create new sources using the button in the workspace view. Each source y
{% codeexample %}
{% codeexampletab JavaScript %}
```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu'
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'All': false,
Expand Down
27 changes: 8 additions & 19 deletions src/connections/sources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,20 @@ You can create new sources using the button in the workspace view. Each source y


```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu'
}, {
integrations: {
'All': false,
'Intercom': true,
'Google Analytics': true,
}
});
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
});
```

{% comment %}
{% codeexample %}
{% codeexampletab JavaScript %}
```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu'
}, {
integrations: {
'All': false,
'Intercom': true,
'Google Analytics': true,
}
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
},
});
```
{% endcodeexampletab %}
Expand Down
6 changes: 3 additions & 3 deletions src/guides/how-to-guides/collect-on-client-or-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ Each Segment library allows an `integrations` object either as a top level obj
This flag may be especially useful in Legacy source types, where an event might be triggered on both the client & server for various reasons. The following will cause the payload to be sent to all enabled tools EXCEPT Facebook Pixel:

```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu'
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'Facebook Pixel': false
Expand Down
20 changes: 10 additions & 10 deletions src/protocols/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ If you no longer want to capture specific traits within `.identify()` and `.grou
All customers can filter specific events from being sent to specific Destinations (except for warehouses) by updating their tracking code. Here is an example showing how to send a single message only to Intercom and Google Analytics:

```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu'
}, {
integrations: {
'All': false,
'Intercom': true,
'Google Analytics': true
}
});
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'All': false,
'Intercom': true,
'Google Analytics': true
}
});
```

Destination flags are case sensitive and match the [Destination's name in the docs](https://segment.com/docs/connections/destinations/) (i.e. "AdLearn Open Platform", "awe.sm", "MailChimp", etc.).
Expand Down
6 changes: 3 additions & 3 deletions src/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
Analytics.js, our Javascript `library`, is the most powerful way to track customer data from your `website`. If you're just starting out, we recommend it over server-side libraries as the simplest installation for any website.

```js
analytics.identify('025pikachu025', {
email: 'peekAtMe@email.poke',
name: 'Pikachu'
analytics.identify('user_123', {
email: 'jane.kim@example.com',
name: 'Jane Kim'
}, {
integrations: {
'All': false,
Expand Down