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' );



🤖 Copy this prompt into your AI agent:

Help me install the clicky.com Rails "Turbo Link" tracking plugin/extension on my website. Read `https://clicky.com/help/plugins-railsturbolink` for what it does and `https://clicky.com/help/agents` for general context. Install and configure it (it may need my site ID and sitekey, ask me to grab that from my site preferences), then verify pageviews are being logged via the API or live view before telling me you're done.



📢 Stop guessing and start growing

Register for Clicky now to get the insights you need