Other Amplitude Features
3 minute read
After you set up Amplitude as a destination and send events in JavaScript device mode, you can optionally add Amplitude Guides & Surveys and Experiment in your application.
These features run in the browser alongside the Amplitude Analytics instance that RudderStack loads in device mode. Amplitude Guides & Surveys requires Browser SDK version 2 — Experiment needs no additional RudderStack destination settings.
Guides & Surveys
Amplitude Guides & Surveys lets you deliver in-product guides and surveys through the Amplitude Engagement bundle.
Note that:
- Your Amplitude destination must use JavaScript device mode with Amplitude Browser SDK version 2.
- Register Guides & Surveys as a plugin on the same Amplitude Analytics instance so device, user, and session identity stay continuous — do not load a second Amplitude Analytics SDK.
Setup
- Set your Amplitude destination to JavaScript device mode and select Amplitude Browser SDK version 2.
- Load
https://cdn.amplitude.com/script/AMPLITUDE_API_KEY.engagement.jsusing the same Amplitude project API key configured in the RudderStack destination. - Because Amplitude Analytics is already loaded and initialized, load the Engagement bundle and register the plugin after
rudderanalytics.ready().
Do not:
- Call another
amplitude.init(),engagement.init(), orengagement.boot()—amplitude.add(window.engagement.plugin())handles initialization.- Run a second, standalone Amplitude Analytics SDK on the page.
A sample CDN setup is shown below. Replace AMPLITUDE_API_KEY with your Amplitude project API key:
<script>
rudderanalytics.ready(function () {
var script = document.createElement('script');
script.src =
'https://cdn.amplitude.com/script/AMPLITUDE_API_KEY.engagement.js';
script.onload = function () {
amplitude.add(window.engagement.plugin());
};
document.head.appendChild(script);
});
</script>If your Amplitude destination uses a Proxy server URL (custom
serverUrl), do not use the Browser SDK plugin path above. Amplitude’s Guides & Surveys plugin does not support proxy configuration.Follow Amplitude’s standalone Guides & Surveys installation and proxy configuration instead.
See Amplitude’s Guides and Surveys Web SDK documentation for full options and troubleshooting.
Experiment
Your application loads and initializes Amplitude Experiment. It requires no additional RudderStack-side integration changes.
When you use Amplitude Analytics through RudderStack JavaScript device mode, you can initialize Experiment with Amplitude’s built-in analytics integration so it shares identity with the Analytics SDK instance on the page.
Setup
- Load the Amplitude Experiment JavaScript client in your application.
- Initialize it with a deployment key from the same Amplitude project you use for analytics.
- Fetch or start the Experiment client and read variants according to Amplitude’s current Experiment SDK documentation.
A sample CDN setup is shown below. Replace DEPLOYMENT_KEY with your Amplitude Experiment deployment key:
<script src="https://unpkg.com/@amplitude/experiment-js-client@1.15.5/dist/experiment.umd.js"></script>
<script>
// Replace DEPLOYMENT_KEY with an Amplitude Experiment deployment key
// from the same Amplitude project used for analytics.
window.experiment =
Experiment.initializeWithAmplitudeAnalytics('DEPLOYMENT_KEY');
</script>If your site uses a consent management platform, gate Experiment initialization and variant fetching until the user grants consent. Amplitude’s Experiment SDK does not provide a separate consent API — see Manage user consent in Amplitude’s documentation.
See Amplitude’s Experiment JavaScript SDK documentation for fetch, start, and variant evaluation details.