designcourse icon indicating copy to clipboard operation
designcourse copied to clipboard

Request for destroy/stop method

Open tyl-paul-lapczynski opened this issue 3 years ago • 36 comments

There is a scenario where I've come across where based on user cookie preferences, it would be ideal if datadogRum could be toggled on/off in a browser session. There looks like there is no API for something like stop, destroy, or uninitialized.

This would facilitate a good user experience without an interrupting full page refresh especially in SPAs.

tyl-paul-lapczynski avatar Aug 20 '21 15:08 tyl-paul-lapczynski

Thank you for your suggestion, we'll consider it.

BenoitZugmeyer avatar Aug 23 '21 12:08 BenoitZugmeyer

Hi, I am having the same issue. We now have to do a page reload an only initialize datadog when consent has been given. Also in the service that uses datadog to send custum events it would be usefull to be able to check if datadog was initialized. What happens if you call datadogRum.addError without it having been initialized?

remkoboschker avatar Jan 13 '22 11:01 remkoboschker

@remkoboschker I'm not sure to see how a way to stop the SDK from collecting data would help in your use-case. It looks like you rather need a way to start collecting data when consent has been given? In this case, I suggest to initialize RUM if/when consent is given. All method calls (like datadogRum.addError) are buffered and will be transmitted only once datadogRum.init is called. How does it sound?

BenoitZugmeyer avatar Jan 17 '22 16:01 BenoitZugmeyer

Thanks, good to know all calls are buffered until init is called. People can revoke or change there consent from within the application. After a consent change there is no way to stop sending other than reloading.

Would buffering all session data impact performance (memory on an older phone) when init is never called?

Thank you for your reply

On 17 Jan 2022, at 17:02, Benoît @.***> wrote:

 @remkoboschker I'm not sure to see how a way to stop the SDK from collecting data would help in your use-case. It looks like you rather need a way to start collecting data when consent has been given? In this case, I suggest to initialize RUM if/when consent is given. All method calls (like datadogRum.addError) are buffered and will be transmitted only once datadogRum.init is called. How does it sound?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

remkoboschker avatar Jan 17 '22 16:01 remkoboschker

People can revoke or change there consent from within the application. After a consent change there is no way to stop sending other than reloading.

Ah, I get it now, it seems like a good use-case for a stop() method. We don't have any plan yet, but we definitely want to implement this API. We'll keep you posted!

Would buffering all session data impact performance (memory on an older phone) when init is never called?

The buffer is bound so it will not leak to much memory. Only the most recent 500 calls are taken into account during init.

BenoitZugmeyer avatar Jan 17 '22 17:01 BenoitZugmeyer

+1 - also need this for a similar cookie consent use case

jademh avatar Jan 31 '22 14:01 jademh

+1 for the stop() method

Also on the same topic (cookie preferences management) but different solution:

if the datadogRum had a privacyMode which didn't set or read cookies, it could still be run in most cases where cookie consent is not given. Some SDK offer methods to set consent so that they can change the behaviour depending on it - it would be great to have something like this.

gaiachik avatar Feb 01 '22 09:02 gaiachik

+1 for this behaviour (cookie consent use case also)

harris-jacob avatar Jul 21 '22 14:07 harris-jacob

+1 - also needed for consent use case

briankwlin avatar Oct 01 '22 00:10 briankwlin

+1

SenorMann avatar Oct 18 '22 12:10 SenorMann

Does anyone have a temp solution for this while we wait?

SenorMann avatar Oct 18 '22 13:10 SenorMann

Also need this method - users can opt in / out. Thanks!

thebrubaker avatar Oct 28 '22 23:10 thebrubaker

+1: is there anything we can do to prioritize this enhancement?

somedeveloper2015 avatar Nov 11 '22 19:11 somedeveloper2015

+1

matthew-garrett avatar Nov 16 '22 16:11 matthew-garrett

+1

constantin-melniciuc avatar Nov 23 '22 13:11 constantin-melniciuc

Just to be clear: you can already implement a "consent" strategy by initializing the SDK only if the user did opt-in:

if (userConsent) {
  DD_RUM.init(...)
}

A stop method would stop data collection, but any data that was collected before calling it would still be sent to Datadog, so it wouldn't be that useful for privacy purposes.

BenoitZugmeyer avatar Nov 23 '22 13:11 BenoitZugmeyer

@BenoitZugmeyer the use case is for when the user withdraws consent (via consent management pop up) after previously having consented. It's valid that data before them withdrawing consent should be sent to datadog - but we want to stop any additional data being sent while they are still on that page (particularly pertinent for SPA where you don't get full page refreshes very often) A workaround could be to force a page refresh if a user edits their consent settings but this adds friction

jademh avatar Nov 23 '22 18:11 jademh

@BenoitZugmeyer My use case is a little different, yet similar. Let's say I have a problematic user, that has more issues than others. I would love to trace back all the user actions. Thus I would love to increase programmatically the sampling rate for specific users. However, since that is not prossible, once the client was initiated, I was thinking of restarting the client with a slightly modified config. To me start-stop would be an universal solution that would allow maximum flexibility in configuration

constantin-melniciuc avatar Nov 24 '22 07:11 constantin-melniciuc

Hi there! We've been using browser logging and RUM SDKs and are really excited about how they have helped us build a better product by understanding our users experiences.

I wanted to add a strong +1 on needing better support for GDPR/tracking consent.

@BenoitZugmeyer is there a reason the browser SDK does not support setTrackingConsent like the other RUM sdks? eg https://docs.datadoghq.com/real_user_monitoring/flutter/setup/#set-tracking-consent

This seems to explicitly solve the problem that every single user of the browser SDK needs to solve, and by making it explicit, makes it much easier to discover how to handle consent. It seems like the current intended solution to rely on the event buffering in init. However, that doesn't seem to be documented in either the browser rum or logging SDK docs.

ssisk avatar Feb 10 '23 17:02 ssisk

is there a reason the browser SDK does not support setTrackingConsent like the other RUM sdks? eg https://docs.datadoghq.com/real_user_monitoring/flutter/setup/#set-tracking-consent

Most of customers needs for now were to delay the init after user consent, which can be achieved by the workaround mentionned by Benoît. We definitely want to provide a more complete way to handle consent at some point but it had not been prioritised yet. I opened https://github.com/DataDog/browser-sdk/issues/2013 if you want to follow the progress on this topic.

bcaudan avatar Feb 13 '23 13:02 bcaudan

+1 also needed for consent case

markoberholzer-es avatar Feb 19 '23 12:02 markoberholzer-es

Implementing a stop() method would be a great workaround to get DD_RUM working for micro-frontends where only a single sub-app is active at a time (somewhat related: https://github.com/DataDog/browser-sdk/issues/1225)

apearce-nov avatar Apr 05 '23 18:04 apearce-nov

We greatly appreciate this option being made available in the browser-sdk

janvandenberg avatar Oct 10 '23 13:10 janvandenberg

+1 This is something we're actively needing now, it boggles the mind how it's not been prioritised given GDPR / Consent management being a core pillar of web compliancy these days.

reggieWayflyer avatar Oct 16 '23 10:10 reggieWayflyer

+1 also needed for consent case

markoberholzer-es avatar Oct 17 '23 08:10 markoberholzer-es

+1

plevavas avatar Oct 20 '23 10:10 plevavas

We have a different use case where clients install our widget on their website and we want to start recording a session once opened and stop once closed.

If we init on open, and stopSession on close, a new session will start again automatically when the user interacts with the webpage further, even if they never open our widget again. We really need a way to start/stop sessions manually so the surrounding website isn't polluting our data with irrelevant interactions and errors.

scottalguire avatar Nov 02 '23 06:11 scottalguire

@scottalguire indeed your use case seems a bit different, let's discuss it here: https://github.com/DataDog/browser-sdk/issues/2490

bcaudan avatar Nov 02 '23 14:11 bcaudan

+1

maisasb avatar Nov 10 '23 16:11 maisasb

+1

Bertie-Chapman avatar Dec 13 '23 04:12 Bertie-Chapman