Skip to content

Instantly share code, notes, and snippets.

@dialtone
Created March 21, 2012 21:21
Show Gist options
  • Select an option

  • Save dialtone/2152947 to your computer and use it in GitHub Desktop.

Select an option

Save dialtone/2152947 to your computer and use it in GitHub Desktop.
(function () {
var _onload = function(){
if (document.readyState && !/loaded|complete/.test(document.readyState)){setTimeout(_onload, 10);return}
if (!window.__adroll_loaded){__adroll_loaded=true;setTimeout(_onload, 50);return}
var scr = document.createElement("script");
var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
scr.setAttribute('async', 'true');
scr.type = "text/javascript";
scr.src = host + "/j/roundtrip.js";
((document.getElementsByTagName('head') || [null])[0] ||
document.getElementsByTagName('script')[0].parentNode).appendChild(scr);};
if (window.addEventListener) {window.addEventListener('load', _onload, false);}
else {window.attachEvent('onload', _onload)}}());
@claudioc
Copy link

I don't think it matters but the IIFE (like yours) are written like (function(){})(); and not (function(){}());
HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment