Skip to content

Instantly share code, notes, and snippets.

@rajbhowmick
Created October 17, 2016 20:18
Show Gist options
  • Save rajbhowmick/5169153acaa283583cb5fc115cd63343 to your computer and use it in GitHub Desktop.
Save rajbhowmick/5169153acaa283583cb5fc115cd63343 to your computer and use it in GitHub Desktop.
// WEB-48778
(function() {
if (adrma.pageInfo.pageType === "receiptPage") {
window.BOOMR_config = {
autorun: false
};
BOOMR = window.BOOMR || {};
BOOMR.debug = true;
BOOMR.plugins = BOOMR.plugins || {};
// holds the beacon until this is true
var complete = false;
// create a custom plugin to hold the beacon until we're ready
BOOMR.plugins.MyCustomPlugin = {
is_complete: function() {
return complete;
}
};
function delayBeacon() {
$.subscribe("receipt/renderSummary", function delayBeaconSub() {
complete = true;
// trigger the beacon
if (typeof BOOMR.page_ready === "function") {
BOOMR.page_ready();
}
});
}
if (window.addEventListener) {
window.addEventListener("load", delayBeacon, false);
} else if (window.attachEvent) {
window.attachEvent("onload", delayBeacon);
}
}
if (adrma.siteSettings.enableSoasta === false) return;
if (window.BOOMR && window.BOOMR.version) {
return;
}
var dom, doc, where, iframe = document.createElement("iframe"),
win = window;
function boomerangSaveLoadTime(e) {
win.BOOMR_onload = (e && e.timeStamp) || new Date().getTime();
}
if (win.addEventListener) {
win.addEventListener("load", boomerangSaveLoadTime, false);
} else if (win.attachEvent) {
win.attachEvent("onload", boomerangSaveLoadTime);
}
iframe.src = "javascript:void(0)";
iframe.title = "";
iframe.role = "presentation";
(iframe.frameElement || iframe).style.cssText = "width:0;height:0;border:0;display:none;";
where = document.getElementsByTagName("script")[0];
where.parentNode.insertBefore(iframe, where);
try {
doc = iframe.contentWindow.document;
} catch (e) {
dom = document.domain;
iframe.src = "javascript:var d=document.open();d.domain='" + dom + "';void(0);";
doc = iframe.contentWindow.document;
}
doc.open()._l = function() {
var js = this.createElement("script");
if (dom) {
this.domain = dom;
}
js.id = "boomr-if-as";
js.src = "//c.go-mpulse.net/boomerang/" + "TWQ9B-XPY2B-SYWFA-TZRH6-M4R4A";
BOOMR_lstart = new Date().getTime();
this.body.appendChild(js);
};
doc.write('<body onload="document._l();">');
doc.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment