Reference for Image
query | Usage | Default | Example |
---|---|---|---|
page | It can be your username or your website url | https://visit-counter.vercel.app/counter.png?page=example.com | |
s | Font size of counter | 40 | https://visit-counter.vercel.app/counter.png?page=example.com&s=60 |
c | Color of counter | #00ff00 | https://visit-counter.vercel.app/counter.png?page=example.com&c=00ffff |
bg | Background Color of counter | transparent | https://visit-counter.vercel.app/counter.png?page=example.com&bg=000000 |
ff | Font Family | Digital | https://visit-counter.vercel.app/counter.png?page=example.com&ff=electrolize |
no | No of digits in Counter | 2 | https://visit-counter.vercel.app/counter.png?page=example.com&no=6 |
Getting the Raw Counts
If you don't want the PNG file but still want the count to use in something else, you can do a GET request to /counter
Using fetch in javascript
fetch("https://visit-counter.vercel.app/counter?page=example.com")
.then(response => response.text())
.then(count => console.log('counts: ',count));
Using Requests in Python
import requests
url = "https://visit-counter.vercel.app/counter?page=example.com"
response = requests.request("GET", url)
print("counts:", response.text)
Using cURL in PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://visit-counter.vercel.app/counter?page=example.com',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo "counts: $response";
Installation
- Get your firebase database URL at here
- Clone the repo
git clone https://github.com/devXprite/visit-counter
- Install NPM packages
cd visit-counter npm install
- Enter your Database URL in
.env
FIREBASE_DATABASE='YOUR DATABASE URL'
- Start Server
npm start
Deploy
Click this button to configure your Project and deploy it to Vercel.