Rails: Tawk.to chat plugin and Turbolinks issue
<p>Hi I want to integrate the chat plugin Tawk.to into my rails app, however adding the script as they give it won't work with Turbolinks, I also tried to add the script into a function and call it on .ready and on page:load however it is not working, this is the original script:</p>

<pre><code>var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
  (function(){
  var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
  s1.async=true;
  s1.src='https://embed.tawk.to/API_KEY/default';
  s1.charset='UTF-8';
  s1.setAttribute('crossorigin','*');
  s0.parentNode.insertBefore(s1,s0);
  })();
</code></pre>

<p>I tried the following in my application.js file:</p>

<pre><code>function tawk_chat(){
    var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
    (function(){
    var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
    s1.async=true;
    s1.src='https://embed.tawk.to/API_KEY/default';
    s1.charset='UTF-8';
    s1.setAttribute('crossorigin','*');
    s0.parentNode.insertBefore(s1,s0);
    })();
}

$(document).on("ready page:load", function() {
  tawk_chat();
});
</code></pre>

<p>The above did not work. How to make work the above script with Turbolinks enabled?</p>