Script preview

Statistics

Browse, copy and download the individual files that make up this script.

Overview: The system provides a lightweight yet powerful visitor analytics solution written in PHP. It replaces traditional external analytics with a privacy-friendly, self-hosted dashboard. The UI features modern Tailwind design and interactive graphs (via Chart.js). Data is stored locally using SQLite, eliminating the need for complex databases.

Key Features: Tracks page views, visitor IPs, and user agents Displays daily visitor counts, last 100 visits, and top 25 visited pages Provides basic IP geolocation from an offline dataset Token-based authentication for admin API and dashboard access Built-in modern UI with charts and color themes Compact tracking snippet for easy embedding in any page

Installation & Setup: Upload all PHP files (stats_dashboard.php, setup.php, etc.) to your web server. Open setup.php in your browser or run it in the terminal: php setup.php It creates the SQLite database (stats.sqlite) and a secure auth_token.json file with your access token. Note the displayed token - you´ll need it for admin dashboard access. Add this snippet to every page you want to track:

<script> (function(){ fetch('stats_dashboard.php?api=log&page='+encodeURIComponent(location.pathname+location.search)); })(); </script>

Visit stats_dashboard.php to view your analytics dashboard. To protect admin access, you can change the token anytime by regenerating it through the setup or a reset script.

Inside the script.

13 files available.

admin.php 10,005 bytes · 294 lines · 2026-09-13 15:27
1<?php
2session_start();
3header('Content-Type: text/html; charset=utf-8');
4
5// Initialize stats
6if (!file_exists('stats.json')) {
7 header('Location: index.php');
auto_tracking.php 508 bytes · 22 lines · 2026-09-13 15:27
1<?php
2// auto_tracking.php - Automatic page name detection
3
4function getCurrentPageName() {
5 $page = basename($_SERVER['PHP_SELF']);
6 $page = str_replace('.php', '', $page);
7 $page = str_replace('_', ' ', $page);
init_tracking.php 624 bytes · 25 lines · 2026-09-13 15:27
1<?php
2// init_tracking.php - One-line tracking initialization
3
4// Function to quickly track any page
5function trackThisPage($customName = null) {
6 include 'tracking.php';
7
pass.txt 8 bytes · 1 lines · 2026-09-13 15:27
1admin123
readme.md 1,450 bytes · 27 lines · 2026-09-13 15:27
1Overview:
2The system provides a lightweight yet powerful visitor analytics solution written in PHP. It replaces traditional external analytics with a privacy-friendly, self-hosted dashboard. The UI features modern Tailwind design and interactive graphs (via Chart.js). Data is stored locally using SQLite, eliminating the need for complex databases.
3
4Key Features:
5Tracks page views, visitor IPs, and user agents
6Displays daily visitor counts, last 100 visits, and top 25 visited pages
7Provides basic IP geolocation from an offline dataset
stats.json 696 bytes · 22 lines · 2026-09-13 15:27
1{
2 "settings": {
3 "site_name": "My Website",
4 "admin_password": "240be518fabd2724ddb6f04eeb1da5967448d7e831c08c8fa822809f74c720a9",
5 "timezone": "UTC"
6 },
7 "visitors": [
stats_dashboard.php 12,829 bytes · 402 lines · 2026-09-13 15:27
1<?php
2session_start();
3header('Content-Type: text/html; charset=utf-8');
4
5// Initialize JSON files
6function initStats() {
7 if (!file_exists('stats.json')) {
test_AUTOTRACK.php 285 bytes · 14 lines · 2026-09-13 15:27
1<?php
2// Just include this one file - no need to specify page name
3include 'auto_tracking.php';
4?>
5<!DOCTYPE html>
6<html>
7<head>
test_DYNAMICTRACK.php 357 bytes · 18 lines · 2026-09-13 15:27
1<?php
2include 'tracking.php';
3
4// Get product ID from URL
5$productId = $_GET['id'] ?? 'unknown';
6
7// Track with dynamic page name
test_RACK.php 291 bytes · 15 lines · 2026-09-13 15:27
1<?php
2// Include tracking at the VERY TOP of your page
3include 'tracking.php';
4logVisitor('About Us');
5?>
6<!DOCTYPE html>
7<html>
test_SIMPELTRACK.php 198 bytes · 11 lines · 2026-09-13 15:27
1<?php include 'init_tracking.php'; ?>
2<!DOCTYPE html>
3<html>
4<head>
5 <title>My Page</title>
6</head>
7<body>
test_SIMPELcustomTRACK.php 257 bytes · 14 lines · 2026-09-13 15:27
1<?php
2include 'init_tracking.php';
3trackThisPage('Special Landing Page');
4?>
5<!DOCTYPE html>
6<html>
7<head>
tracking.php 2,397 bytes · 79 lines · 2026-09-13 15:27
1<?php
2// tracking.php - Visitor tracking functions
3
4function logVisitor($page = 'Home') {
5 // Initialize JSON file if it doesn't exist
6 if (!file_exists('stats.json')) {
7 $initialData = [

Download Script

Get the complete source for Statistics — every file, ready to drop into your project.

Copied to clipboard!