Created
September 5, 2013 17:52
-
-
Save weisjohn/6453681 to your computer and use it in GitHub Desktop.
Google Analytics beforeunload inpsection
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
// this code isn't intended to work: | |
if (J.body) { | |
a = aa(a); | |
try { | |
var c = J[qa]('<iframe name="' + a + '"></iframe>') | |
} catch (d) { | |
c = J[qa]("iframe"), ha(c, a) | |
} | |
c.height = "0"; | |
c.width = "0"; | |
c.style.display = "none"; | |
c.style.visibility = "hidden"; | |
var e = J[z], | |
e = ("https:" == J[z][A] || M.G ? "https://ssl.google-analytics.com" : "http://www.google-analytics.com") + "/u/post_iframe.html#" + aa(e[A] + "//" + e[u] + "/favicon.ico"), | |
f = function() { | |
c.src = ""; | |
c.parentNode && c.parentNode.removeChild(c) | |
}; | |
Ga(W, "beforeunload", f); | |
var Be = !1, | |
k = 0, | |
s = function() { | |
if (!Be) { | |
try { | |
if (9 < k || c.contentWindow[z][u] == J[z][u]) { | |
Be = !0; | |
f(); | |
Ha(W, "beforeunload", f); | |
b(); | |
return | |
} | |
} catch (a) {} | |
k++; | |
ca(s, 200) | |
} | |
}; | |
Ga(c, "load", s); | |
J.body.appendChild(c); | |
c.src = e | |
} else We(function() { | |
Ee(a, b) | |
}, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment