Last active
July 14, 2016 22:31
-
-
Save phillipadsmith/65611468ec78b50a0e480f641cc1c22f to your computer and use it in GitHub Desktop.
Chartbeat weirdness
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
<script type='text/javascript'> | |
var _sf_async_config = _sf_async_config || {}; | |
/** CONFIGURATION START **/ | |
_sf_async_config.uid = #####; //CHANGE THIS | |
_sf_async_config.domain = 'YourDomain.com'; //CHANGE THIS | |
_sf_async_config.useCanonical = true; | |
_sf_async_config.sections = 'Change this to your Section name'; //CHANGE THIS | |
_sf_async_config.authors = 'Change this to your Author name'; //CHANGE THIS | |
/** CONFIGURATION END **/ | |
(function() { | |
function loadChartbeat() { | |
window._sf_endpt = (new Date()).getTime(); | |
var e = document.createElement('script'); | |
e.setAttribute('language', 'javascript'); | |
e.setAttribute('type', 'text/javascript'); | |
e.setAttribute('src', '//static.chartbeat.com/js/chartbeat.js'); | |
document.body.appendChild(e); | |
} | |
var oldonload = window.onload; | |
window.onload = (typeof window.onload != 'function') ? | |
loadChartbeat : function() { | |
oldonload(); | |
loadChartbeat(); | |
}; | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are the scenarios where
line 18line 20 above might NOT fire the loadChartbeat function?This is copied from here: http://support.chartbeat.com/docs/#code