Simplest way to monitor visits on your website (No Purchase, No Sign Up)
Haris Ahmad
Posted on August 7, 2022
Yes, you don't have to purchase an Analytics Service or sign up to some sketchy application just to know simple thing like how many visits did your site has. Just with a few lines of code you can easily find out the overall visit count of your website.
2 Steps to install this service
Step 1: Add the following JavaScript to your Website ⚙️
Add the following code to your website where it is called every time a user visits (Could be your homepage). Replace [YOUR WEBSITE NAME] to your Website name or any other uniquely identifiable string
window.onload = function (){
fetch('https://api.countapi.xyz/hit/[YOUR WEBSITE NAME]/visits')
}
Step 2: View the Page Visits 🕵
To get the page view you can visit the following endpoint
https://api.countapi.xyz/get/[YOUR WEBSITE NAME]/visits
Wait✋! but it might not be end for you
The example that I have provided is the bare minimum setup you need to do to monitor the visits. You might want to monitor the visits on each page of your site separately or want to have rather complex analytics. Thanks to CountAPI which gives us this tooling for free. For more complex 'Visit Analytics', please go ahead and read the docs from CountAPI
Liked the solution?
If you liked the post you can read more from me. For more please follow me on my social media handles provided below
Blog👉 https://hariscodes.com/
Twitter👉 https://twitter.com/tweetharisahmad
Instagram👉 https://www.instagram.com/hariscodes/
Posted on August 7, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.