Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to load SumoMe script in a turbolinks-friendly way
$ ->
$(document).on("page:change", ->
sumo = document.createElement("script")
sumo.type = "text/javascript"
sumo.async = true
sumo.src = "//"
sumo.setAttribute('data-sumo-site-id', 'your sumo me ID')
(document.getElementsByTagName("head")[0] or document.getElementsByTagName("body")[0]).appendChild(sumo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment