Check If Google Analytics Script Is In The Page Template
function hasAnalyticsGoogle(){
var scripts = document.getElementsByTagName('script'),
ga = true, ua = true, dc = false,
i, len, s;
len = scripts.length;
if (ga || ua || dc) {
for (i = 0; i < len; i += 1) {
s = scripts[i].src;
if (
(ga && s.indexOf('google-analytics.com/ga.js')>-1) ||
(ua && s.indexOf('google-analytics.com/analytics.js')>-1) ||
(dc && s.indexOf('doubleclick.net/dc.js')>-1)
) {
return true;
}
}
}
return false;
}