Skip to content
Open
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
17 changes: 13 additions & 4 deletions content/collections/browser_sdk/en/browser-unified-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@
platform: Browser
full_details: true
---
The Unified SDK provides a single entry point for all Amplitude features, including Analytics, Experiment, and Session Replay. It simplifies the integration process by handling the initialization and configuration of all components.
The Unified SDK provides a single entry point for all Amplitude features, including Analytics, Experiment, Session Replay, and Guides and Surveys. It simplifies the integration process by handling the initialization and configuration of all components.

{{partial:admonition type="beta" heading="Beta Release"}}
The Browser Unified SDK is currently in beta. There may be breaking changes before the stable release. Amplitude recommends testing thoroughly in a development environment before you deploy to production.
{{/partial:admonition}}

{{partial:admonition type="info" heading="Individual Product Installation"}}
The Unified SDK installs Analytics, Experiment, and Session Replay. If you're concerned about bundle size and only need specific products, you can install them individually:
The Unified SDK installs Analytics, Experiment, Session Replay, and Guides and Surveys. If you're concerned about bundle size and only need specific products, you can install them individually:

- [Analytics](/docs/sdks/analytics/browser/browser-sdk-2) - For tracking user events and behavior
- [Experiment](/docs/sdks/experiment-sdks/experiment-javascript) - For running A/B tests and feature flags
- [Session Replay](/docs/session-replay/session-replay-standalone-sdk) - For capturing and replaying user sessions

The Unified SDK doesn't support Guides and Surveys. If you need Guides and Surveys functionality, use the [Guides and Surveys SDK](/docs/guides-and-surveys/sdk) directly.
- [Guides and Surveys](/docs/guides-and-surveys/sdk) - For in-product messaging and surveys
{{/partial:admonition}}

## Install the SDK
Expand Down Expand Up @@ -70,6 +69,7 @@
- [Analytics Browser SDK](/docs/sdks/analytics/browser/browser-sdk-2)
- [Experiment JavaScript SDK](/docs/sdks/experiment-sdks/experiment-javascript)
- [Session Replay Standalone SDK](/docs/session-replay/session-replay-standalone-sdk)
- [Guides and Surveys Web SDK](/docs/guides-and-surveys/sdk)
{{/partial:admonition}}

```typescript
Expand Down Expand Up @@ -119,6 +119,11 @@
// Experiment options
experiment: {
// Experiment configuration options
},

// Guides and Surveys options
engagement: {
// Guides and Surveys configuration options
}
});
```
Expand All @@ -144,3 +149,7 @@
### Experiment options

All options from `@amplitude/plugin-experiment-browser` are supported. See the [Experiment documentation](/docs/sdks/experiment-sdks/experiment-javascript#configuration) for details.

### Guides and Surveys options

Check warning on line 153 in content/collections/browser_sdk/en/browser-unified-sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Guides and Surveys options' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Guides and Surveys options' should use sentence-style capitalization.", "location": {"path": "content/collections/browser_sdk/en/browser-unified-sdk.md", "range": {"start": {"line": 153, "column": 5}}}, "severity": "INFO"}

The Unified Browser SDK supports all [Guides and Surveys options](/docs/guides-and-surveys/sdk#initialize-the-sdk). The engagement plugin initializes automatically when you pass engagement options in the configuration.
38 changes: 32 additions & 6 deletions content/collections/guides_and_surveys/en/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Guides and Surveys supports different installation options to work best with your existing Amplitude implementation, if you have one.

### Amplitude Browser SDK
### Amplitude Browser SDK 2

Check warning on line 16 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Amplitude Browser SDK 2' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Amplitude Browser SDK 2' should use sentence-style capitalization.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 16, "column": 5}}}, "severity": "INFO"}

Install the Guides and Surveys SDK with a script, or as a package with npm or Yarn.

Expand Down Expand Up @@ -47,15 +47,36 @@
{{/partial:tab}}
{{/partial:tabs}}


For additional configuration, supply `InitOptions` to the `plugin` function. See [Initialize the SDK](#initialize-the-sdk) below for the available options.

{{partial:admonition type="note" heading=""}}
If you are using the above install approach, then Guides and Surveys is now installed! By default, all Guides and Surveys events are sent to your project.

Check warning on line 53 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Passive] 'are sent' looks like passive voice. Raw Output: {"message": "[Microsoft.Passive] 'are sent' looks like passive voice.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 53, "column": 130}}}, "severity": "INFO"}
{{/partial:admonition}}

Behind the scenes, `amplitude.add(engagementPlugin())` takes care of both `init` and `boot`. However, this option can only be used with the [Amplitude Analytics Browser SDK 2](/docs/sdks/analytics/browser/browser-sdk-2).

Check warning on line 56 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Passive] 'be used' looks like passive voice. Raw Output: {"message": "[Microsoft.Passive] 'be used' looks like passive voice.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 56, "column": 124}}}, "severity": "INFO"}

You should only call `init` and `boot` if you (a) want to use a proxy; (b) want to customize the event handling via the `integrations` option. You can learn more about using a proxy [here](/docs/guides-and-surveys/proxy). You can find details about the `integrations` option [here](/docs/guides-and-surveys/sdk#other-amplitude-sdks-and-third-party-analytics-providers).

Check warning on line 58 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Amplitude.WordChoice] Use 'through' instead of 'via'. Raw Output: {"message": "[Amplitude.WordChoice] Use 'through' instead of 'via'.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 58, "column": 113}}}, "severity": "WARNING"}

Check warning on line 58 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Semicolon] Try to simplify this sentence. Raw Output: {"message": "[Microsoft.Semicolon] Try to simplify this sentence.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 58, "column": 70}}}, "severity": "INFO"}

### Amplitude Unified SDK

Check warning on line 60 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'Amplitude Unified SDK' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'Amplitude Unified SDK' should use sentence-style capitalization.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 60, "column": 5}}}, "severity": "INFO"}

If you're using the [Amplitude Unified SDK](/docs/sdks/analytics/browser/browser-unified-sdk), Guides and Surveys comes out of the box. Just provide the engagement options during initialization:

```ts
import { initAll } from '@amplitude/unified';

initAll('YOUR_API_KEY', {
// Other Amplitude SDK options...
engagement: {
// Guides and Surveys options go here...
}
});
```

Enable Guides and Surveys in your Amplitude project settings before guides and surveys can display. See the [Unified SDK documentation](/docs/sdks/analytics/browser/browser-unified-sdk#guides-and-surveys-options) for details.

Check warning on line 75 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Amplitude.WordChoice] Use 'go to', 'navigate to', or 'review' instead of 'See'. Raw Output: {"message": "[Amplitude.WordChoice] Use 'go to', 'navigate to', or 'review' instead of 'See'.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 75, "column": 101}}}, "severity": "WARNING"}

### Other Amplitude SDK's and third-party analytics providers

If you don't use the Amplitude Analytics [Browser SDK 2](/docs/sdks/analytics/browser/browser-sdk-2), you can still use Guides and Surveys but you need to configure the SDK to work with your other Amplitude Analytics SDK or third-party analytics provider. First, add the SDK to your project using the script tag, or through npm or Yarn as outlined above.
If you don't use the [Amplitude Analytics Browser SDK 2](/docs/sdks/analytics/browser/browser-sdk-2) or the [Amplitude Analytics Unified SDK](/docs/sdks/analytics/browser/browser-unified-sdk), you can still use Guides and Surveys but you need to configure the SDK to work with your other Amplitude Analytics SDK or third-party analytics provider. First, add the SDK to your project using the script tag, or through npm or Yarn as outlined above.

Check warning on line 79 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Microsoft.SentenceLength] Try to keep sentences short (< 30 words). Raw Output: {"message": "[Microsoft.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 79, "column": 1}}}, "severity": "INFO"}
But, instead of calling `amplitude.add(window.engagement.plugin())`, you need to call `init` and `boot`.

#### Initialize the SDK
Expand Down Expand Up @@ -99,6 +120,10 @@
});
```

{{partial:admonition type="note" heading=""}}
When using a proxy, you need to call `window.engagement.boot` to fully install Guides and Surveys, even if you are using the Browser SDK v2. Make sure to set up event handling via the `integrations` option.

Check warning on line 124 in content/collections/guides_and_surveys/en/sdk.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Amplitude.WordChoice] Use 'through' instead of 'via'. Raw Output: {"message": "[Amplitude.WordChoice] Use 'through' instead of 'via'.", "location": {"path": "content/collections/guides_and_surveys/en/sdk.md", "range": {"start": {"line": 124, "column": 177}}}, "severity": "WARNING"}
{{/partial:admonition}}

##### Example: Initialization with CSP nonce

For Content Security Policy (CSP) compliance, include a nonce value:
Expand Down Expand Up @@ -134,11 +159,11 @@
device_id: 'DEVICE_ID',
user_properties: {},
},
// needed for insights and responses to populate
// needed for insights and responses to populate
integrations: [
{
track: (event) => {
analytics.track(event.event_type, event.event_properties)
amplitude.track(event.event_type, event.event_properties)
}
},
],
Expand All @@ -148,7 +173,8 @@
To use *On event tracked* [triggers](/docs/guides-and-surveys/guides/setup-and-target#triggers), forward events from your third-party analytics provider to Guides and Surveys. The Guides and Surveys SDK doesn't send these events to the server.

```js
analytics.on('track', (event, properties, options) => { // Example for Segment Analytics
analytics.on('track', (event, properties, options) => {
// Example for Segment Analytics
window.engagement.forwardEvent({ event_type: event, event_properties: properties});
});
```
Expand Down
Loading