$(document).on('page:before-change', function() {
window.turbolinks_referer = location.href;
});
$(document).on('page:load', function() {
if (window.turbolinks_referer) {
// yandex metrika
if (window.yaCounter7915231) {
window.yaCounter7915231.hit(location.href, $('title').html(), window.turbolinks_referer);
}
// google analytics
if (window.ga) {
window.ga('send', 'pageview');
}
}
});