title | contributors | issues | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Olark |
|
|
The supplied javascript will look something like this:
<script>
window.olark || (function(c){
// initialization code
})({
loader: "static.olark.com/jsclient/loader0.js",
name: "olark",
methods: ["configure", "extend", "declare", "identify"]
});
olark.identify('<your identity string>');
</script>
To get it working with Turbolinks:
- Move the script inside the head tags.
- Convert the anonymous initialization function into a named function.
- Bind this new function to the
page:load
event.
An example solution, in jQuery:
function initOlark(){
c = {
loader: "static.olark.com/jsclient/loader0.js",
name: "olark",
methods: ["configure", "extend", "declare", "identify"]
};
//initialization code
}
window.olark || initOlark();
$(document).bind('page:load', function(){
initOlark();
olark.identify('<your identity string>');
});