Skip to content

Instantly share code, notes, and snippets.

@Gegam
Created November 23, 2016 11:00
Show Gist options
  • Select an option

  • Save Gegam/7d472cb95c7c5ba5c236064ac204e70b to your computer and use it in GitHub Desktop.

Select an option

Save Gegam/7d472cb95c7c5ba5c236064ac204e70b to your computer and use it in GitHub Desktop.
//1. Google Analytics
<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');
ga('create', 'UA-81706562-27', 'auto', {'name':'g'});
ga('g.require', 'displayfeatures');
try {
var args = JSON.parse(location.search.match(/custom_args=(.+)($|&)/)[1]);
[ 'campaignName'
, 'campaignSource'
, 'campaignMedium'
, 'campaignContent'
].forEach(function (argName) {
ga('set', argName, args[argName]);
})
} catch (err) {}
ga('g.set', 'location', location.protocol + '//' + location.host + location.pathname);
ga('g.set', 'referrer', location.protocol + '//' + location.host);
ga('g.send', 'pageview', '/');
</script>
//2. Счетчик ТОП:
<!-- Rating@Mail.ru counter -->
<script type="text/javascript">
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "2837517", type: "pageView", start: (new Date()).getTime()});
(function (d, w, id) {
if (d.getElementById(id)) return;
var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id;
ts.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//top-fwz1.mail.ru/js/code.js";
var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
})(document, window, "topmailru-code");
</script><noscript><div style="position:absolute;left:-10000px;">
<img src="//top-fwz1.mail.ru/counter?id=2837517;js=na" style="border:0;" height="1" width="1" alt="Рейтинг@Mail.ru" />
</div></noscript>
<!-- //Rating@Mail.ru counter -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment