Is there a way to completely disable tracking and clean the tracker buffer while using BrowserTracker? We have some an asynchronous condition after the user already started browsing and there could be a possibility that we need to buffer up some events, check that condition, and then send events and continue tracking or discard them completely and stop tracking.
The only approach that I am aware of is to use the opt-out cookie setting. This will result in all tracked events to be discarded (i.e., not tracked), so probably might not be exactly what you are looking for as you said that you want to buffer up the events while tracking is disabled.
Hi Marcin - can I ask what the conditional check is in this case that you are looking for and then selectively sending or discarding?
@mike It’s an HTTP call to check if we are in a country that we are interested in.
EDIT: @matus Yep, unfortunately this doesn’t really suit us because we would like to buffer up those events.
I wanted to write a small plugin - the idea was to set the buffer size to
Number.POSITIVE_INFINITY temporarily and then continue with something like the opt-out cookie to disable the tracking completely if that async check failed, if not then just flush the buffer and continue tracking. But the thing is most of the BrowserTracker code is completely isolated, for example buffer size of
outQueues and one would need to pass the config of the BrowserTracker to the plugin to restore the previous value because you can’t read the current buffer size from BrowserTracker instance.
So, I’m looking for some ideas here. If it’s not possible I guess we’ll pass the expected buffer size to the plugin.