Unloading Plugins based on Path
Hi All,
Does anyone know if this wrapper allows for the ability to unload and then load a separate Segment.com writeKey based on the router path? I can't find any documentation on unloading plugins
What we're trying to do is exclude Segment.com from loading marketing (google ads, Bing etc.) on App paths. What makes this hard to do with NextJS is that it will persist the script across marketing/app pages and you cannot do a analytics.load("") update call in analytics.js because segment re-writes these functions (I think)
You can conditionally enable/disable stuff https://getanalytics.io/conditional-loading/#enabling--disabling-plugins
routerListenerThingie((route) => {
if (route === 'foo') {
analytics.plugins.disable(['segment])
}
})
Or perhaps you can initialize another analytics instance without those plugins and call that instances .page, .track etc.