Yes, you can implement sampling in Atatus Browser Monitoring by using the following code to apply rate limiting to the atatus.js
script.
// 50% probability, this will add Atatus snippet.
if ((Math.random() * 100) < 50 && !document.getElementById("atatus")) {
var scriptTag = document.getElementsByTagName("script")[0];
var element = document.createElement("script");
element.id = "atatus";
element.onload = element.onreadystatechange = function() {
atatus.config("YOUR_API_KEY", {
}).install();
};
element.crossorigin = "anonymous",
element.src = "https://dmc1acwvwny3.cloudfront.net/atatus-spa.js",
scriptTag.parentNode.insertBefore(element, scriptTag);
}
The example above demonstrates a 50% sampling rate. To adjust the sampling rate to your desired level, you can modify the configuration accordingly.
You have to change the YOUR_API_KEY to your project API Key.