简体   繁体   中英

Installing Olark in Ruby on Rails

I have JavaScript code from Olark that requires you to add to the HTML body somewhere.

I added the JavaScript code to assets/javascript/olark.js and appended a require olark.js to application.js

Nothing happens in my app. What else do I need to do to make Olark appear?

In the code that olark provides you there are some HTML tags. Remove the HTML tags and it should work.

Here is my setup:

app/assets/javascripts/application.js

//= require olark

app/assets/javascripts/olark.js

...olark code they provide when you sign up without html

The problem is that with turbolink activated, when I clic on an internal link, the chat widget is no longer available. I think that I can use the same tip of this topic on Google Analytics with Rails issue . If someone have a tip on that? ;)

There is an alternative solution to the accepted answer by @Bruno.

You can put the code snippet into a partial, and render it in your view.

This feels neater to me because you do not need to manually remove html codes. You can use the code snippet as provided without any modification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM