Rails "Turbo Link" tracking Web Analytics Plugin

⬅️ Back to all plugins  

Rails 4+ uses turbo links by default (similar to pjax) which loads the content of the page and inserts it without doing a full page refresh. Unfortunately without a full page refresh, Clicky won't track the new page loading by default.

However, Turbo links provide a callback when the user changes page, which you can hook into like this to track with Clicky:

Rails 4:

$(document).on 'page:change', ->
  if window.clicky?
    clicky.log( document.location.pathname + document.location.search, document.title, 'pageview' );

Rails 5+:

$(document).on 'turbolinks:load', ->
  if window.clicky?
    clicky.log( document.location.pathname + document.location.search, document.title, 'pageview' );



Looking for a fresh web analytics experience?

📢 Register for Clicky now and use the plugin/instructions on this page to track your website!