Skip to content

Commit

Permalink
Added google analytics. Fixed code for showing last 24 hour
Browse files Browse the repository at this point in the history
  • Loading branch information
sushant-hiray committed Jun 16, 2016
1 parent af6c222 commit 591a8c0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
16 changes: 13 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@
$(".timeago").timeago();
});
</script>
</head>
<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','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-40046157-5', 'auto');
ga('send', 'pageview');

</script>
</head>

<body>

Expand All @@ -48,7 +58,7 @@
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="https://sushant-hiray.me/posts">Blog</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/container -->
Expand Down Expand Up @@ -77,7 +87,7 @@ <h2 class="imgloader text-center"><small>Loading...</small></h2><br/>

<div id="footer">
<div class="container">
<p class="text-muted credit">Built with love by <a href="https://www.facebook.com/sushant.hiray">@Sushant</a>.</p>
<p class="text-muted credit">Built with love by <a href="https://sushant-hiray.me">@Sushant</a>.</p>
</div>
</div>

Expand Down
7 changes: 6 additions & 1 deletion js/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ $(document).ready(function(){
$.each(all_data_list.sort(compare_by_points).reverse(), function(idx,row) {
var d = new Date(0);
d.setUTCSeconds(row.posted_time);
var cur = new Date();
var timeDiff = Math.abs(cur.getTime() - d.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
row.idx = idx + 1;
row.timeago_string = jQuery.timeago(d);
row.iso_string = d.toISOString();
var output = template_row(row);
$('#data-table').append(output);
if (diffDays <= 1) {
$('#data-table').append(output);
}
});
})
.error(function(){
Expand Down

0 comments on commit 591a8c0

Please sign in to comment.