intercom / intercom-rails

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

Insert script immediately if loaded with Turbo #352

Closed eugeneius closed 3 months ago

eugeneius commented 3 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.