ProfileCrest Developer Blog โ€” Analytics & Tracking Tutorials
ANALYTICS & METRICS August 5, 2026 8 min read CodeCrest Engineering Team

How to Add a Dynamic Visitor Counter Badge to Your GitHub Profile README

Track genuine engagement on your developer portfolio without violating user privacy. Understand how GitHub's Camo image proxy processes SVG badges, configure custom styling parameters, and prevent view count inflation.

1. How Visitor Counters Work Inside GitHub

Standard websites track traffic using client-side JavaScript tags such as Google Analytics, Plausible, or PostHog. GitHub profile READMEs, however, are strictly sanitized Markdown documents. For security and anti-cross-site-scripting (XSS) reasons, GitHub strips all <script> tags and interactive embeds.

Instead, profile tracking relies on dynamic SVG pixel requests:

  1. A user navigates to your profile at github.com/your-username.
  2. GitHub encounters an image tag pointing to a counter endpoint (e.g. https://komarev.com/ghpvc/?username=...).
  3. Instead of loading directly from the external URL, GitHub routes the request through its secure, anonymizing asset proxy: GitHub Camo (camo.githubusercontent.com).
  4. Camo requests the asset from the counter API, passing request headers.
  5. The counter service increments the unique visitor count in its Redis/PostgreSQL database and returns an SVG badge with HTTP headers specifying Cache-Control: max-age=0, no-cache so subsequent views trigger real-time updates.

2. Complete Configuration & URL Syntax

The most widely trusted open-source visitor counter for GitHub is maintained by Anton Komarev. Here is the complete production syntax:

<!-- Standard Markdown Embed -->
![Profile Views](https://komarev.com/ghpvc/?username=YOUR_GITHUB_USERNAME&color=cc785c&style=for-the-badge&label=PROFILE+VIEWS)

Supported Query Parameters

ParameterDefaultDescription & Example
usernameRequiredYour exact GitHub handle (case-sensitive).
colorblueRight-hand badge hex color without # (e.g., cc785c).
styleflatVisual shape: for-the-badge, flat-square, or plastic.
labelPROFILE VIEWSCustom left-side text. Use + or %20 for spaces.
base0Starting offset if migrating from an existing counter service.

3. Perfect Alignment with Shields.io Badges

A common aesthetic flaw is placing a rounded flat visitor badge alongside square for-the-badge technology shields. This creates jarring height discrepancies. To align your visitor badge seamlessly into a header capsule:

<p align="center">
  <img src="https://komarev.com/ghpvc/?username=yourhandle&color=cc785c&style=flat-square&label=VISITORS" alt="Visitor Counter" />
  <img src="https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square" alt="PRs Welcome" />
  <img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="License" />
</p>

4. Avoiding Inflation & Handling Camo Caching

Two issues frequently perplex developers using visitor badges:

Why does the counter count my own refreshes?

Most free counting services use basic IP hashing with a 24-hour deduplication window. If you test your profile by editing and refreshing, your local IP will only be counted once per day. However, if you switch networks (cellular to Wi-Fi), a new view will register.

Why did my counter get stuck?

Occasionally GitHub Camo caches an image for up to 300 seconds if the counter server fails to send strict no-storeheaders. If your counter lags behind real visits, wait 5 minutes; it will catch up once Camo's TTL invalidates.

5. Building a Private Counter with Cloudflare Workers

If you want 100% control over your metrics without relying on third-party public infrastructure, you can deploy a zero-cost Cloudflare Worker with KV storage. The worker intercepts the Camo request, increments an atomic key in KV, and returns a dynamic SVG response with custom SVG font kerning in under 15 milliseconds.

Generate Harmonious Badges with ProfileCrest

ProfileCrest automatically synchronizes your visitor counter badge style, colors, and dimensions with your tech stack badges.

๐Ÿš€ Open ProfileCrest Generator
Previous: Senior Leadership GuideNext: Readme Stats Customization