Here I am going to show you a simple trick which can be used to keep track on every views plus add a like button with various customize options. But first lets just dive into the code. Instead of going into Layout we are going to paste this code in our Post Itself. Just change Compose View to HTML View & Paste it under your post content. This Code is for View Counter (Blogspot also has its own widget called Blog's Stats in Add a Gadget option. But it will not show you View Count on Each Post / Pages. But this code will. ) <!-- View Counter BEGIN --> <script> window .onload = function () { var xhr = new XMLHttpRequest(); var url = window .location.href.replace( "https://" , "" ).replace( /\//g , "" ); var urlr = url.substring( 0 , 53 ); //document.getElementById("demo").innerHTML = urlr; xhr.open( "GET" , "https://api.countapi.xyz/hit/" +urlr); x...
Comments
Post a Comment