How to get number of visitors as a count in a web page (portfolio) in Angular?
JavaScript/jQuery/HTML/CSS code will be appreciated.
How to get number of visitors in a web page (portfolio) in Angular?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Sachin SinghRank #66 · 26.2K reputationPosted Jun 10, 2021, 4:39 PM EDT
At first, I want to tell you that it's impossible to achieve it solely using client-side languages until you use a third-party library that will store the info on the server for you as you don't want to use the server-side things.
So, you can use Count.IO which is very dangerous, because if anyone knows the string you use then he will be able to hack the system.
here is the code.
step 1. Call the below function from your portfolio page. (ready function is enough to call it)
$.ajax({ url:"http://count.io/vb/myCountString/users+", type: "POST" });step 2. Call the below function where you want to display the user's count
$.ajax({ url:"http://count.io/vb/myCountString/", success: function(data) { alert(data.counts[0].count); } });Note:- myCountString, is a random string that I used, you can use anything here, but if anybody knows it then, he can hack your system.