devrnt/react-use-intercom

Don't load intercom in some pages?

Closed this issue · 7 comments

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

nacq commented

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 autoBoot prop

Yes so you have to manually boot in each page no?

nacq commented

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

Yes 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 ?

devrnt commented

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 #657 (comment)