intercom / intercom-rails

The easiest way to install Intercom in a Rails app.
https://developers.intercom.io/reference
MIT License
281 stars 107 forks source link

Insert script immediately if loaded with Turbo #352

Closed eugeneius closed 7 months ago

eugeneius commented 7 months ago

For https://github.com/intercom/intercom-rails/issues/351.

When the Messenger shim is loaded with Turbo, the load event has already fired, so adding an event listener for it won't have any effect. Instead we can immediately add the script tag to the page.

Also stop calling Intercom('reattach_activator'), which is an obsolete API that no longer does anything.