Introduction
If anyone has trouble setting up Datadog RUM, I would like to tell them, "The setup code for JS/NPM version has some incorrect." I have previously texted Datadog support about the feedback, but it has not been fixed, so I wrote it.
1. Typo in the snippet
As you can see in the screenshot, a snippet is provided as a sample, but unfortunately, a typo has.
Look at line 3, the curly bracket {
has been used, datadogRum.init({.
But the }
never has been stated in the snippet.
Here is the collect snippet.
import { datadogRum } from '@datadog/browser-rum'; datadogRum.init({ applicationId: 'hoge-hoge-hoge', clientToken: 'hoge-hoge-hoge', site: 'datadoghq.com', service:'temp', // Specify a version number to identify the deployed version of your application in Datadog // version: '1.0.0', sampleRate: 100, replaySampleRate: 100, trackInteractions: true, defaultPrivacyLevel:'mask-user-input', }); datadogRum.startSessionReplayRecording();
2. Disabled Session Replay
If you wanna disable session replay, you also have to be careful with this setup page. There is a toggle, Session Replay Enabled, which seems to allow the snippet to be edited to disable the function.
However, only this setting doesn't seem sufficient...😅 You also must set replaySampleRate: 0
Set replaySampleRate to 0 to stop collecting the RUM Session Replay plan which includes replays, resources, and long tasks.
That's why here is the collect snippet!
import { datadogRum } from '@datadog/browser-rum'; datadogRum.init({ applicationId: 'hoge-hoge-hoge-b2e3-40e049c84c81', clientToken: 'hoge-hoge-hoge-881b380180c1171d17', site: 'datadoghq.com', service:'temp', // Specify a version number to identify the deployed version of your application in Datadog // version: '1.0.0', sampleRate: 100, replaySampleRate: 0, trackInteractions: true, );
Happy Monitoring!
Top comments (0)