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
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.
21
+
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.
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.
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:
28
+
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:
29
29
30
30
-[Analytics](/docs/sdks/analytics/browser/browser-sdk-2) - For tracking user events and behavior
31
31
-[Experiment](/docs/sdks/experiment-sdks/experiment-javascript) - For running A/B tests and feature flags
32
32
-[Session Replay](/docs/session-replay/session-replay-standalone-sdk) - For capturing and replaying user sessions
33
-
34
-
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.
33
+
-[Guides and Surveys](/docs/guides-and-surveys/sdk) - For in-product messaging and surveys
35
34
{{/partial:admonition}}
36
35
37
36
## Install the SDK
@@ -70,6 +69,7 @@ For detailed information about each product's features and APIs, refer to their
-[Guides and Surveys Web SDK](/docs/guides-and-surveys/sdk)
73
73
{{/partial:admonition}}
74
74
75
75
```typescript
@@ -119,6 +119,11 @@ initAll('YOUR_API_KEY', {
119
119
// Experiment options
120
120
experiment: {
121
121
// Experiment configuration options
122
+
},
123
+
124
+
// Guides and Surveys options
125
+
engagement: {
126
+
// Guides and Surveys configuration options
122
127
}
123
128
});
124
129
```
@@ -144,3 +149,7 @@ Sample Rate controls the rate at which Amplitude captures session replays. For e
144
149
### Experiment options
145
150
146
151
All options from `@amplitude/plugin-experiment-browser` are supported. See the [Experiment documentation](/docs/sdks/experiment-sdks/experiment-javascript#configuration) for details.
152
+
153
+
### Guides and Surveys options
154
+
155
+
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.
For additional configuration, supply `InitOptions` to the `plugin` function. Go to [Initialize the SDK](#initialize-the-sdk) below for the available options.
50
51
51
-
For additional configuration, supply `InitOptions` to the `plugin` function. See [Initialize the SDK](#initialize-the-sdk) below for the available options.
52
+
{{partial:admonition type="note" heading=""}}
53
+
After the installation steps are complete, by default all Guides and Surveys events are sent to your project.
54
+
{{/partial:admonition}}
55
+
56
+
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).
57
+
58
+
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).
52
59
60
+
### Amplitude Unified SDK
53
61
62
+
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:
54
63
64
+
```ts
65
+
import { initAll } from'@amplitude/unified';
66
+
67
+
initAll('YOUR_API_KEY', {
68
+
// Other Amplitude SDK options...
69
+
engagement: {
70
+
// Guides and Surveys options go here...
71
+
}
72
+
});
73
+
```
74
+
75
+
Enable Guides and Surveys in your Amplitude project settings before guides and surveys can display. Go to [Unified SDK documentation](/docs/sdks/analytics/browser/browser-unified-sdk#guides-and-surveys-options) for details.
55
76
56
77
### Other Amplitude SDK's and third-party analytics providers
57
78
58
-
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.
79
+
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.
59
80
But, instead of calling `amplitude.add(window.engagement.plugin())`, you need to call `init` and `boot`.
When using a proxy, 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 through the `integrations` option.
125
+
{{/partial:admonition}}
126
+
102
127
##### Example: Initialization with CSP nonce
103
128
104
129
For Content Security Policy (CSP) compliance, include a nonce value:
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.
149
174
150
175
```js
151
-
analytics.on('track', (event, properties, options) => { // Example for Segment Analytics
0 commit comments