Forked from jaimeiniesta/setup_sumo_me.js.coffee
Last active
September 2, 2015 13:38
-
-
Save danielpuglisi/d2b89ca39edfaa1f7cd5 to your computer and use it in GitHub Desktop.
How to load SumoMe script in a turbolinks-friendly way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ -> | |
$(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