Skip to content

Examples

Unique visitors instead of raw views

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
metric: views-unique
label: 'Unique visitors'
color: brightgreen

Clones counter

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
metric: clones
label: 'Clones'
color: orange
output: clones.svg

Embed it:

![Clones](https://raw.githubusercontent.com/OWNER/REPO/traffic-data/clones.svg)

Custom hex color

A 6-character hex (no leading #):

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
color: ff66cc

Large flat style

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
style: for-the-badge
font-size: 14
abbreviated: true

Lowercase label (shields.io style)

Most badges on shields.io render their label in lowercase. Pass lowercase: true to match that look:

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
label: 'Repo views'
lowercase: true

Renders the left side as repo views regardless of the casing you pass in label. The for-the-badge style still uppercases (that’s part of the style), so combining the two has no visible effect.

Migrating from another counter

If you already had a counter showing 5,000, preserve the displayed total:

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
base: 5000

The base is added on top of the real Traffic-API total.

Multiple badges from one repo

Run the Action twice with different output filenames so the two badges live side by side on the data branch:

jobs:
views-badge:
runs-on: ubuntu-latest
steps:
- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
metric: views
output: views.svg
color: blue
label: 'Views'
clones-badge:
runs-on: ubuntu-latest
steps:
- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
metric: clones
output: clones.svg
color: orange
label: 'Clones'

Custom branch name

If traffic-data collides with something in your repo, change it:

- uses: albertoarena/github-traffic-badge@v1
with:
token: ${{ secrets.TRAFFIC_TOKEN }}
branch: badge-data

Then point the README at the new branch:

![Traffic](https://raw.githubusercontent.com/OWNER/REPO/badge-data/badge.svg)