fullstorydev / fullstory-browser-sdk

Official FullStory SDK for JavaScript, for web browsers
MIT License
55 stars 17 forks source link

Provide A Way To Manipulate Payloads Before Sending Them To FullStory Using A Callback #109

Open Zozman opened 3 years ago

Zozman commented 3 years ago

Problem

Currently there seems to be no way to manipulate information collected by FullStory on the client before it is sent to FullStory (particularly the network calls). If you waned to do something like sensor any value matching a Regex or remove a particular piece of data before it's sent off (like removing IP addresses or something), you can't.

Proposal

Provide a callback that allows access to the payload before it is sent that can be used to manipulate the payload before it leaves the client (Sentry for example provides a very easy to use beforeSend hook in their SDK just for this purpose).

Proposed Example Syntax

window['_fs_before_send'] = function(payload) {
     // Here manipulate the payload object as needed
     // For example, if there is an ip here, remove it
     delete payload.ip;
     // Then return the object and the SDK can then send it
     return payload;
};
luser commented 2 years ago

Hi there! Thanks for the suggestion! In general, this repository exists purely as a way to utilize the FullStory Client API via an npm package. Because of that, this isn't the correct venue for feature suggestions on that API. Such requests would be more useful directed at FullStory Customer Support, who can ensure that it's brought to the attention of the relevant development team internally.

That being said, I can tell you that there is in-progress work to implement something very similar to what you've requested here. When that work hits general availability I'll update this issue with more details.

timoteialbu commented 1 month ago

When that work hits general availability I'll update this issue with more details.

@luser any update on that feature availability? We would love to be able to standardize around a callback like beforeSend as we use both Datadog and Sentry which have that mechanism.