amplitude / Amplitude-TypeScript

TypeScript Amplitude Analytics SDK
https://amplitude.github.io/Amplitude-TypeScript/
MIT License
132 stars 37 forks source link

Session replay standalone CDN script initialisation #799

Closed steverob closed 3 months ago

steverob commented 3 months ago

Summary

I'm looking to use the CDN version of the standalone session replay plugin. I am unable to figure out how to initialise it with the API key and start recording.

I'm using rudderstack as my instrumentation framework and it can give me sessionId & deviceId.

I'm only able to call the "plugin" function on the session replay object made available via the CDN script and it does not seem to take api key.

kwalker3690 commented 3 months ago

@steverob Thanks for calling our attention here, it looks like our docs are missing instructions for the Standalone Session Replay SDK initialization via script tag. I'll make updates to our docs, but in the meantime you can use the following script:

<script src="https://cdn.amplitude.com/libs/session-replay-browser-1.10.0-min.js.gz"></script>
<script>
window.sessionReplay.init(AMPLITUDE_API_KEY, {
    deviceId: "<string>",
    sessionId: "<number>",
    sampleRate: "<number>"
    ...
 })
</script>

And then please follow the rest of the guidance on how to update the session id and grab the event properties in this documentation: https://amplitude.com/docs/session-replay/session-replay-standalone-sdk

steverob commented 3 months ago

@kwalker3690 thanks for your response. But it seems like init is not available on the sessionReplay object.

screen-grab-2024-07-04T19 54 19

screen-grab-2024-07-04T19 55 53

kwalker3690 commented 3 months ago

@steverob please check the comment above and confirm you have the matching script tag, it looks to me like you're still using the plugin script tag. You need to use the standalone script tag (it should not have the word 'plugin' in it)

steverob commented 3 months ago

Ahh thanks!

— Steve Robinson On Jul 4, 2024 at 9:13 PM +0530, Kelly Wallach @.***>, wrote:

@steverob please check the comment above and confirm you have the matching script tag, it looks to me like you're still using the plugin script tag. You need to use the standalone script tag (it should not have the word 'plugin' in it) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>