https://github.com/aveek-saha/view-counter-badge

📈 A badge to count the number of visitors to your page

https://github.com/aveek-saha/view-counter-badge

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • â—‹
    .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Academic email domains
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (11.4%) to scientific vocabulary

Keywords

badge-generator badgen badges shields-io view-count view-counter visitor-badge visitor-count visitor-counter
Last synced: 9 months ago · JSON representation

Repository

📈 A badge to count the number of visitors to your page

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 10
  • Open Issues: 0
  • Releases: 0
Topics
badge-generator badgen badges shields-io view-count view-counter visitor-badge visitor-count visitor-counter
Created about 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Code of conduct

README.md

View Counter Badge

View counter badge

Count how many visitors any page gets. A simple solution to add a view counter badge to your readme files or web page.

Usage

The view counter badge is meant to be deployed individually for each profile/user. Click the button and then follow the steps below to deploy your own view counter in no time!

Deploy to Cloudflare Workers

Set your app name

In wrangler.toml and change the name property - this will be the subdomain that your app is published on.

Your Cloudflare workers domain will be of the format {your-worker-domain}.workers.dev. When you publish an app on a Worker, it will be published on a subdomain corresponding to your app name - {worker-name}.{your-worker-domain}.workers.dev by default.

Create a KV

Create a new namespace for your KV, it's important that you name it ViewCounter. Then edit your wrangler.toml and change the kv_namespaces property with the id. It should look something like this.

toml kv_namespaces = [ {binding = "ViewCounter", id = "{your-kv-id}"} ]

Get your Account ID and create a new API Token

To get your account ID:

  • Go to https://dash.cloudflare.com > Workers
  • Copy your account ID

To create a new API Token:

  • Go to https://dash.cloudflare.com/profile/api-tokens > Create Token
  • Give your token a name (i.e. Github Actions)
  • Choose start with template
  • Select the "Edit Cloudflare Workers" template
  • Account Resources > Include > {your account}
  • Zone Resources > Include > All zones from account > {your account}

Once done, navigate to your GitHub repository > Settings > Secrets and add the following secrets:

``` - Name: CFAPITOKEN - Value: your-api-token

  • Name: CFACCOUNTID
  • Value: your-account-id ```

Now if you push a new commit into master and you'll find your view counter deployed at {worker-name}.{your-worker-domain}.workers.dev

Add counter to README

html <img src="https://<Your-cloudflare-deployment>.workers.dev" alt="View counter badge" />

OR

markdown ![View counter badge](https://<Your-cloudflare-deployment>.workers.dev)

Customization

You can pass arguments to customize your view counter. The badge is created using badgen so all the options supported by badgen except for icon and iconWidth can be used.

| Parameter | Default | Allowed values | Example | | :----------: | :-----: | :-----------------------------: | :----------------: | | label | Views | Any string | label=Visitors | | labelColor | 555 | RGB values or valid color names | labelColor=black | | color | blue | RGB values or valid color names | color=green | | style | flat | flat or classic | style=classic | | scale | 1 | Any integer | scale=2 |

Valid color names are: blue, cyan, green, yellow, orange, red, pink, purple, grey, black

Example of a counter with parameters:

https://<Your cloudflare deployment>.workers.dev?style=classic&labelColor=black&color=green

Owner

  • Name: Aveek Saha
  • Login: Aveek-Saha
  • Kind: user
  • Location: Boston, MA
  • Company: @akamai

Cloud Computing, Machine Learning and Full Stack. SDE co-op @akamai. MSCS student @northeastern. Previously at @HewlettPackard, @altimetrik & @ IIT Kgp.

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Total issue authors: 0
  • Total pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • Aveek-Saha (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/deploy_worker.yml actions
  • actions/checkout v2 composite
  • cloudflare/wrangler-action 1.3.0 composite
package-lock.json npm
  • prettier 1.19.1 development
  • badgen 3.2.2
package.json npm
  • prettier ^1.18.2 development
  • badgen ^3.2.2