From 29ff016c198a0d7ad7126a5978834990ef209dbe Mon Sep 17 00:00:00 2001 From: sanscontext Date: Mon, 3 Feb 2020 14:25:42 -0800 Subject: [PATCH] Goodbye pikachu example --- src/connections/destination-data-control.md | 7 ++--- .../server/pixel-tracking-api/index.md | 4 +-- .../libraries/website/javascript/index.md | 31 +++++++++---------- src/connections/sources/index-tonik.md | 6 ++-- src/connections/sources/index.md | 27 +++++----------- .../collect-on-client-or-server.md | 6 ++-- src/protocols/schema.md | 20 ++++++------ src/styleguide.md | 6 ++-- 8 files changed, 46 insertions(+), 61 deletions(-) diff --git a/src/connections/destination-data-control.md b/src/connections/destination-data-control.md index 65d0c85acf..e0913d9f39 100644 --- a/src/connections/destination-data-control.md +++ b/src/connections/destination-data-control.md @@ -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, diff --git a/src/connections/sources/catalog/libraries/server/pixel-tracking-api/index.md b/src/connections/sources/catalog/libraries/server/pixel-tracking-api/index.md index 1f8e95de0f..beb861f80c 100644 --- a/src/connections/sources/catalog/libraries/server/pixel-tracking-api/index.md +++ b/src/connections/sources/catalog/libraries/server/pixel-tracking-api/index.md @@ -33,11 +33,11 @@ Each endpoint *always* responds with a `200 `, 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" } } ``` diff --git a/src/connections/sources/catalog/libraries/website/javascript/index.md b/src/connections/sources/catalog/libraries/website/javascript/index.md index e3b88b2e37..db22f7494f 100644 --- a/src/connections/sources/catalog/libraries/website/javascript/index.md +++ b/src/connections/sources/catalog/libraries/website/javascript/index.md @@ -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: @@ -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: @@ -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, @@ -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, @@ -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 }) }) @@ -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' }); @@ -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' @@ -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' }, @@ -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}" diff --git a/src/connections/sources/index-tonik.md b/src/connections/sources/index-tonik.md index 6e8e55fb3a..508c8491a0 100644 --- a/src/connections/sources/index-tonik.md +++ b/src/connections/sources/index-tonik.md @@ -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, diff --git a/src/connections/sources/index.md b/src/connections/sources/index.md index 71b42a55dd..320dc2f4c6 100644 --- a/src/connections/sources/index.md +++ b/src/connections/sources/index.md @@ -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 %} diff --git a/src/guides/how-to-guides/collect-on-client-or-server.md b/src/guides/how-to-guides/collect-on-client-or-server.md index f2fbea094b..3dba24fad9 100644 --- a/src/guides/how-to-guides/collect-on-client-or-server.md +++ b/src/guides/how-to-guides/collect-on-client-or-server.md @@ -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 diff --git a/src/protocols/schema.md b/src/protocols/schema.md index 2827a6342c..9818eca647 100644 --- a/src/protocols/schema.md +++ b/src/protocols/schema.md @@ -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.). diff --git a/src/styleguide.md b/src/styleguide.md index f7604b821e..9d386784f6 100644 --- a/src/styleguide.md +++ b/src/styleguide.md @@ -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,