Skip to content

Instantly share code, notes, and snippets.

@danielpuglisi
Forked from jaimeiniesta/setup_sumo_me.js.coffee
Last active September 2, 2015 13:38
Show Gist options
  • Save danielpuglisi/d2b89ca39edfaa1f7cd5 to your computer and use it in GitHub Desktop.
Save danielpuglisi/d2b89ca39edfaa1f7cd5 to your computer and use it in GitHub Desktop.
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 = "//load.sumome.com/"
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