Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abdheshnayak/hits

A Simple to implement hits counter in your static website
https://github.com/abdheshnayak/hits

Last synced: 14 days ago
JSON representation

A Simple to implement hits counter in your static website

Awesome Lists containing this project

README

        

# Hits Counter

A simple way to implement views/visits counter on your website.

get api key here [https://rapidapi.com/abdheshnayak/api/counter10](https://rapidapi.com/abdheshnayak/api/counter10)

**Example**

![viewsCount](https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=44fcc7f8f7mshacfcb91fc4190bfp189dddjsnaa696e83052d%26%26ID=testpage)

## Implementation

#### Decide a page id which will be unique.

Your **page id** must not contain any **space** and please use a **unique** keyword.

And your every individual **page** needs a new **unique id**.

So, I suggest to use your id like this:
if your domain is **eample.com** and page is home

```
example_com_home
or
eample-com-home
or
eeamplecomhome
```

> or you can use a nike name like,

```
ak-example_com_home
```

# Implementation

### In HTML

You just need to implement an IMG tag in your HTML source code. and put the value of src attribute as given below

```
test page
```

where you have to just change your ID
like

```
ID=eample-com
```

so the link will be

```
https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=api-key%26%26ID=eample-com
```

### Example

```



Views Counter Test Page


Views Counter Test Page


testpage

```

### In README.md

```
![viewsCount](https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=44fcc7f8f7mshacfcb91fc4190bfp189dddjsnaa696e83052d%26%26ID=testpage)
```

### Showing without updating Count

You can use IDV for see only views without updating views count.
**example:**

```
https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=44fcc7f8f7mshacfcb91fc4190bfp189dddjsnaa696e83052d%26%26IDV=testpage
```

## Use Different Color

You can select the badge of your with different color, also for doing that you have to add do only one attribute i.e. color in the link.

>

brightgreengreenyellowgreenyelloworangeredbluelightgrey
successimportantcriticalinformationalinactive
bluevioletff69b49cf

Select a color from above and then use it like this.

```
above_link%26%26COLOR=colorname
```

like,

```
https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=api-key%26%26IDV=testpage%26%26COLOR=blueviolet
```

**Result**

![viewsCount](https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=44fcc7f8f7mshacfcb91fc4190bfp189dddjsnaa696e83052d%26%26IDV=testpage%26%26COLOR=blueviolet)

## Lable Color

You can also change lable color by adding %26%26CLABEL=colorname

```
above_link%26%26CLABEL=colorname
```

like,

```
https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=api-key%26%26IDV=testpage%26%26COLOR=blueviolet%26%26CLABEL=green
```

**Result**

![viewsCount](https://img.shields.io/endpoint?url=https://counter10.p.rapidapi.com/?rapidapi-key=44fcc7f8f7mshacfcb91fc4190bfp189dddjsnaa696e83052d%26%26IDV=testpage%26%26COLOR=blueviolet%26%26CLABEL=green)

## Built With

- **NodeJs**
- **MongoDb**

## LICENSE

This project is licensed under the Apache License 2.0 - see the [LICENSE](https://github.com/abdheshnayak/static-website-views-counter/blob/master/LICENSE) file for details

## Authors

> **Abdhesh Nayak**

[![Icon](https://img.shields.io/badge/Github-lightgrey)](https://github.com/abdheshnayak) [![Icon](https://img.shields.io/badge/LinkedIn-blue)](https://www.linkedin.com/in/abdhesh-nayak/)

**See also the list of [Contributors](https://github.com/abdheshnayak/static-website-views-counter/contributors) who participated in this project.**