Date of slack thread: 6/14/24
Anonymous: Hi team! Is there a way we can limit/remove AutoCapture events being sent from our website to StatSig? We have JS snippet on our site to allow our marketing team to run experiments through the sidecar feature but since the Web Analytics product shipped, our tracked events on StatSig spiked up and we don’t actively use any of the autocaptured events.
Matt Garnes (Statsig): <@U02P9J1F4TH> <@U01RGJ9N4N8> correct me if I’m wrong but I think what you’ll need to do here is follow the “Advanced Setup” section at the bottom of source
<script src="https://cdn.jsdelivr.net/npm/@statsig/js-client@latest/build/statsig-js-client+session-replay+web-analytics.min.js"></script>
<script>
const { StatsigClient, runStatsigAutoCapture, runStatsigSessionReplay } = window.Statsig;
const client = new StatsigClient(
YOUR_CLIENT_KEY, // put your client sdk key here - "client-XXXX"
{ userID: 'optional' } // set a userID here if you have one
);
// REMOVE THIS LINE HERE
runStatsigAutoCapture(client);
// REMOVE THIS LINE HERE
runStatsigSessionReplay(client);
client.initializeAsync().catch((err) => console.error(err));
</script>
Matt Garnes (Statsig): I pasted the code snippet above but you have to remove the autocapture line to disable that feature
Anonymous: We are implementing statsig’s sidecar on our website using a JS snippet:
<script src="https://cdn.jsdelivr.net/npm/statsig-sidecar/dist/index.min.js?apikey=client-xxx"></script>
Anonymous: Thanks! Will try this out
Matt Garnes (Statsig): great! let us know how it goes
Vijaye (Statsig): Actually hang on - that won’t work with sidecar
Vijaye (Statsig): How urgent is this? I think adding an argument in the script tag would be ideal and I can have that done by this weekend if it’s not currently urgent
Matt Garnes (Statsig): Glad I tagged you!
Anonymous: Semi-urgent but that timeline works. Appreciate the fast turnaround!
Vijaye (Statsig): Awesome - you got it. Thanks for bringing this up
Vijaye (Statsig): Okay, I’ve pushed the update to side-car.js. You can now add a query param: autocapture=0
to prevent auto capturing of events. So your script tag will now look like this:
<script src="https://cdn.jsdelivr.net/npm/statsig-sidecar/dist/index.min.js?apikey=client-key&autocapture=0"></script>
Anonymous: Amazing, incredible shipping speed! Will add this in.