calibreapp / react-live-chat-loader

Implement a live chat beacon in your React application without performance regressions.
https://react-live-chat-loader.now.sh
MIT License
529 stars 60 forks source link

Use with device-based Segment integration? #55

Closed nicholaschiang closed 3 years ago

nicholaschiang commented 3 years ago

Right now, I'm using Segment's device-based Intercom integration to load the Intercom script, identify users, and sync analytics events.

Do you have any suggestion for how to use this facade with Segment? Ideally, I'm thinking it'll work like this:

  1. Your facade stubs a global window.Intercom function that enables other scripts (like Segment) to call the Intercom API while the actual Intercom widget is still being fetched.
  2. Segment calls your stubbed Intercom API whenever their analytics methods are called.
  3. Your facade dynamically fetches the Intercom widget and, once fetched, calls the actual Intercom API with the parameters received by your stubbed API (that way, events aren't lost while Intercom's widget is being fetched).

I've also opened a support ticket with Segment, because I'm guessing they'll be able to help more than you guys.

nicholaschiang commented 3 years ago

Also, if you're curious, the project I'm using this on is completely non-profit and open-source: tutorbookapp/tutorbook

benschwarz commented 3 years ago

Hey @nicholaschiang,

Do you have any suggestion for how to use this facade with Segment?

Um, not really, no! As far as I understand Segment either pings back to base to find the integrations that should be loaded, or you configure them to be loaded directly, is that right? I don't imagine it's possible to side-load one of their integrations and still have the event tracking system work as normal.

You'd probably have to crack into their source code and implement something custom, which seems risky if Segment change anything on their end.

I do know segment has server-side events relayed to third party services, if that's an option with intercom, maybe you can use react-live-chat-loader client side, then have segment funnelling events server side?

For now I'll close off this issue as it's not something we're able to directly support or help with. If you have any breakthroughs or additional information to share, please do so 👍