Skip to content

devXprite/visit-counter

Repository files navigation


visits

Visit Counter

Easy way to know how many visitors are viewing your Github, Website


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
tb Text to put before count "" https://visit-counter.vercel.app/counter.png?page=example.com&tb="Count: "
ta Text to put after count "" https://visit-counter.vercel.app/counter.png?page=example.com&ta=" visitors"

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

  1. Get your firebase database URL at here
  2. Clone the repo
    git clone https://github.com/devXprite/visit-counter
  3. Install NPM packages
    cd visit-counter
    npm install
  4. Enter your Database URL in .env
    FIREBASE_DATABASE='YOUR DATABASE URL'
  5. Start Server
    npm start

Deploy

Click this button to configure your Project and deploy it to Vercel.

Deploy with Vercel