GitHubViewsCounter is an open-source, lightweight tool to track and display the total views of GitHub repositories or profiles in real-time. It is designed to work seamlessly in GitHub README files and dynamically updates every time someone visits your repository or profile.
- Features
- Live Demo and Examples
- Getting Started
- Usage
- Customization
- Technology Stack
- Challenges and Design Decisions
- Acknowledgments
- Bug Reporting
- License
- Code of Conduct
- Contact
-
Dynamic Total Views Counter:
- Automatically updates when someone accesses your GitHub README.md.
-
Valid Repository Verification:
- Ensures valid repositories and usernames by sending an HTTP HEAD request to verify repository existence.
-
Customizable Themes:
- Offers
light
,dark
, and fully customizable themes (background, text, and border colors).
- Offers
-
Responsive Design:
- Works on any screen size and aligns perfectly in GitHub README files.
-
Sorted Repositories:
- Displays repositories sorted by views (highest to lowest).
-
Protected Data:
- Uses IP-based proxy-safe tracking, compatible with GitHub's
camo
system.
- Uses IP-based proxy-safe tracking, compatible with GitHub's
-
Live Counter for Users:
- Tracks the total number of users utilizing GitHubViewsCounter, displayed on counters.
- Repository View Counter (Light Theme):
Preview:
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcr.php?username=openlab-x&repository=OpenQRCode&theme=light)
- Repository View Counter if the repository doesn't exist:
Preview:
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcr.php?username=openlab-x&repository=OpenQRCode&theme=light)
- Profile View Counter (Dark Theme):
Preview:
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcmp.php?username=openlab-x&theme=dark)
- Profile View Counter if the username doesn't exist:
Preview:
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcmp.php?username=CuttyGirl69&theme=dark)
git clone https://github.com/openlab-x/GitHubViewsCounter.git
cd GitHubViewsCounter
- Use PHP’s built-in server:
php -S localhost:8000 -t api/
- Alternatively, deploy on Apache/Nginx or use XAMPP.
Ensure the data/
directory is writable:
chmod -R 755 data/
To add a view counter for a specific repository, use the following Markdown:
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcr.php?username=yourusername&repository=yourrepo&theme=light)
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcr.php?username=openlab-x&repository=OpenQRCode&theme=dark)
To display total views across all repositories:
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcmp.php?username=yourusername&theme=dark)
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcmp.php?username=openlab-x&theme=light)
theme=light
: Default light theme.theme=dark
: A darker theme.
You can define custom colors using hex values for the following parameters:
Parameter | Description |
---|---|
bgColor |
Background color (e.g., bgColor=222222 ) |
textColor |
Text color (e.g., textColor=FFFFFF ) |
borderColor |
Border color (e.g., borderColor=FF0000 ) |
![GitHubViewsCounter](https://openlabx.com/githubviewscounter/api/gitvcr.php?username=openlab-x&repository=OpenQRCode&bgColor=333333&textColor=00FF00&borderColor=FF0000)
- PHP: Core backend logic for real-time tracking and dynamic image generation.
- GD Library: Creates visually appealing and customizable counters.
- GitHub Proxy Handling: Ensures compatibility with GitHub’s camo.githubusercontent.com proxy for image requests.
- cURL: Validates repositories and usernames by sending an HTTP HEAD request.
- JSON: Lightweight storage for tracking data.
- HTML/Markdown: For embedding counters into GitHub README files.
- Custom Theming: Allows developers to specify colors and styles dynamically via URL parameters.
-
No Country-Based Tracking
- GitHub proxies images, masking visitor IPs. As a result, geolocation is impossible, as we wanted to display the views as based on country locations and show more details.
- To maintain simplicity and privacy, GitHubViewsCounter focuses solely on view counts.
-
Repository and Username Validation
- Ensures users cannot add repositories or usernames they don’t own by sending HTTP HEAD requests to validate the URLs.
-
Dynamic Calculations
- Total views and repository-specific views are recalculated dynamically for accuracy.
-
Modular Design
- Separate scripts handle profile-wide counters (
gitvcmp.php
) and repository-specific counters (gitvcr.php
).
- Separate scripts handle profile-wide counters (
We welcome contributions! Here's how you can help:
- Give the project a STAR.
- Follow us on Github.
- Follow us on Social Media.
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes.
- Submit a pull request.
- Please make sure to update tests as appropriate.
Special thanks to the OpenLabX Team for developing this project and to all contributors.
If you encounter a bug:
- Create an issue in the GitHub Repository.
- Provide a detailed description, including steps to reproduce the issue.
This project is licensed under the MIT License.
We aim to maintain a welcoming environment. Please follow our Code of Conduct.
For inquiries, reach out to the OpenLabX Team:
- Website: https://openlabx.com
- Email: [email protected]
Follow Us: