react-use-intercom
react-use-intercom copied to clipboard
Don't load intercom in some pages?
Hi,
is it possible to don't boot intercom on some pages?
I tried somethings like this:
const forbiddenUrls = ["/purchases/create", "/products"];
return (
<IntercomProvider
appId={INTERCOM_APP_ID}
autoBoot
shouldInitialize={!forbiddenUrls.includes(pathname)}>
{children}
</IntercomProvider>
)
But it does not seems to work.
Regards
Hey @imclint21, I didn't want to load the intercom scripts in certain pages and to do so I did something very similar to your example and it is working the only difference is that I'm not using the autoBoot prop
Hey @imclint21, I didn't want to load the intercom scripts in certain pages and to do so I did something very similar to your example and it is working the only difference is that I'm not using the
autoBootprop
Yes so you have to manually boot in each page no?
Hey @imclint21, I didn't want to load the intercom scripts in certain pages and to do so I did something very similar to your example and it is working the only difference is that I'm not using the
autoBootpropYes so you have to manually boot in each page no?
Yes, that's what I'm doing. I have a wrapper component in charge of doing the boot and I'm wrapping with it the pages where I want the script to load
Any idea @devrnt ?
Please provide a reproduction so I can take a look
Unfortunately I'll not have time, maybe I could help you tu understand what I want to achieve?
See solution from @nacq https://github.com/devrnt/react-use-intercom/issues/657#issuecomment-1717718938