react-use-intercom icon indicating copy to clipboard operation
react-use-intercom copied to clipboard

Don't load intercom in some pages?

Open imclint21 opened this issue 2 years ago • 6 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

imclint21 avatar Sep 12 '23 12:09 imclint21

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

nacq avatar Sep 12 '23 19:09 nacq

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?

imclint21 avatar Sep 12 '23 22:09 imclint21

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

nacq avatar Sep 13 '23 14:09 nacq

Any idea @devrnt ?

imclint21 avatar Sep 13 '23 17:09 imclint21

Please provide a reproduction so I can take a look

devrnt avatar Dec 18 '23 14:12 devrnt

Unfortunately I'll not have time, maybe I could help you tu understand what I want to achieve?

imclint21 avatar Dec 30 '23 21:12 imclint21

See solution from @nacq https://github.com/devrnt/react-use-intercom/issues/657#issuecomment-1717718938

devrnt avatar Jun 13 '24 20:06 devrnt