fullstorydev / fullstory-browser-sdk

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

Support recording sampleRate #80

Open id0Sch opened 3 years ago

id0Sch commented 3 years ago

As a way to limit traffic and data usage, we (at the company I work for) implemented a recording sampleRate mechanism over the legacy snippet.

we do something like this:

const sampleRate = 0.02

.....

require('./external/fullstory') 
window.FS.shutdown() 

if (Math.random() <= sampleRate) {
    ....
    window.FS.restart()
}

It could be nice to have this functionality come out of the box via the npm module. Let me know what you think. Thanks!

patrick-fs commented 3 years ago

Hey @id0Sch thanks for your suggestion! We'll look into this.