Thứ Tư, 25 tháng 10, 2017

Chèn code Google Analytics vào Blogspot và Wordpress




Dưới đây là đoạn code chèn vào Blogspot hoặc Wordpress:

Đối với Blogspot vào chỉnh sửa HTML tìm đoạn </head> thêm đoạn code dưới vào trước nó




<script>
  (function(i,s,o,g,r,a,m){i[&#39;GoogleAnalyticsObject&#39;]=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,&#39;script&#39;,&#39;https://www.google-analytics.com/analytics.js&#39;,&#39;ga&#39;);

  ga(&#39;create&#39;, &#39;UA-92266982-1&#39;, &#39;auto&#39;);
  ga(&#39;send&#39;, &#39;pageview&#39;);

</script>

nhớ thay ID màu đỏ cho từng web/blog , kết quả như sau:

Next

Related