L
L
linklee2016-09-11 16:46:46
WiFi
linklee, 2016-09-11 16:46:46

Rails put yandex metric and jivochat with turbolinks?

Now live chat jivochat.com and Yandex metric are incorrectly displayed.
Let's say we go to another page through turbolinks and the online chat disappears.
At the same time, Yandex webvisor thinks that visitors are always on 1 page.
Here is the code:

var ready;
ready = function() {
  console.log('turbolinks are ready!');
  //jivosite
  (function(){ var widget_id = '2qq06akKwZ';var d=document;var w=window;function l(){
  var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//code.jivosite.com/script/widget/'+widget_id; var ss = document.getElementsByTagName('script')[0]; ss.parentNode.insertBefore(s, ss);}if(d.readyState=='complete'){l();}else{if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
  //yandex metrika
  (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter39034390 = new Ya.Metrika({ id:39034390, clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true, trackHash:true, ut:"noindex" }); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks"); 
};

$(document).ready(ready);
$(document).on('page:load', ready);

here is the site if you need www.optimapo.ru

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
MelisZh, 2016-08-02
@MelisZh

routers from two operators, both connected to the LAN, 2 swarm router distributes the Internet via Wi-Fi

E
efkot, 2016-08-02
@efkot

Yes, damn it, everything is just in one segment, two DHCPs, and the first gored the second. The solution is simpler: the first router, the first provider, has its own network segment, the second router, the second provider, has its own network segment separate from the first.
The solution is more complicated, we put one router more seriously like routerboard.com/RB3011UiAS-RM
We configure routing on it and scatter clients by type of traffic to different providers. Reconfigure your old routers as access points.
Profit!!!

A
Anton Kostin, 2016-09-11
@anton9

Let's say we go to another page through turbolinks and the online chat disappears.

How does this part look like?
If it's link_to, then try adding method::get
link_to 'Ссылка', some_link_path, method: :get

try$(document).on('turbolinks:load', ready)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question