This is a basic example showing how to use the Page Views Tracker service
to track page views on your website.
Domain Tracking
The script below automatically tracks page views for your domain:
<script src="http://hard-house.club/track.js"></script>
This page is being tracked!
The script is loaded and working. Check the dashboard to see the views.
View Counter Display
You can display view counts anywhere on your page using the
data-page-views
attribute:
<div data-page-views data-format="{views}
views">Loading...</div>
Custom format examples:
GitHub Pages Tracking
For GitHub Pages repositories, use the specialized tracking script:
<script
src="http://hard-house.club/track-gh-pages.js"></script>
And display views with:
<div data-gh-page-views data-format="{page}: {views}
views">Loading...</div>
View GitHub Pages Example →
📊 Fetching Views via API
You can also fetch view counts programmatically using the API endpoints:
Domain Views (Regular Websites)
GET /api/views/[domain]
fetch('https://hard-house.club/api/views/example.com')
.then(response => response.json())
.then(data => console.log(data.views));
GitHub Pages Views
GET /api/views-page/[page-id]
fetch('https://hard-house.club/api/views-page/username-repository')
.then(response => response.json())
.then(data => console.log(data.views));
Example Response
{
"domain": "example.com",
"views": 42,
"message": "Page view tracked successfully"
}
💡 Pro Tip: Use these endpoints to build custom analytics dashboards,
display view counts in your admin panels, or integrate with other analytics tools.