Optional google analytics

This commit is contained in:
Dude 2017-03-29 20:26:08 +05:30
parent b675abfa79
commit 5fd6a88ff9
3 changed files with 12 additions and 10 deletions

View File

@ -25,4 +25,7 @@ linkedin: alandoe
github: sharu725 github: sharu725
twitter: '@webjeda' twitter: '@webjeda'
# Tracker
analytics: UA-83979019-1
#Update all the sections by editing the files inside _includes folder. #Update all the sections by editing the files inside _includes folder.

6
_includes/analytics.html Normal file
View File

@ -0,0 +1,6 @@
<!-- 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', '{{site.analytics}}','auto');
ga('send', 'pageview');</script>

View File

@ -3,13 +3,6 @@
<script type="text/javascript" src="{{site.baseurl}}/assets/plugins/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript" src="{{site.baseurl}}/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- custom js --> <!-- custom js -->
<script type="text/javascript" src="{{site.baseurl}}/assets/js/main.js"></script> <script type="text/javascript" src="{{site.baseurl}}/assets/js/main.js"></script>
<script> {% if site.analytics %}
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ {% include analytics.html %}
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), {% endif %}
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-83979019-1', 'auto');
ga('send', 'pageview');
</script>