Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s4k1dl0/bot-analytics-with-php
A PHP-based application for detecting and logging bot activity on your website. This project utilizes CrawlerDetect to differentiate between human users and crawlers, storing relevant data in a MySQL database.
https://github.com/s4k1dl0/bot-analytics-with-php
bot-analytics bot-report composer crawler-detection mysql mysql-database php php-pdo
Last synced: 15 days ago
JSON representation
A PHP-based application for detecting and logging bot activity on your website. This project utilizes CrawlerDetect to differentiate between human users and crawlers, storing relevant data in a MySQL database.
- Host: GitHub
- URL: https://github.com/s4k1dl0/bot-analytics-with-php
- Owner: S4k1dl0
- Created: 2024-10-20T18:33:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-20T19:02:08.000Z (4 months ago)
- Last Synced: 2025-01-18T13:21:56.450Z (18 days ago)
- Topics: bot-analytics, bot-report, composer, crawler-detection, mysql, mysql-database, php, php-pdo
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bot Analytics With PHP
A PHP-based application for detecting and logging bot activity on your website. This project utilizes CrawlerDetect to differentiate between human users and crawlers, storing relevant data in a MySQL database.
## Features
- Detects various web crawlers and bots using the CrawlerDetect library.
- Logs bot activity with relevant details such as IP address, user agent, domain name, full path, and check value.
- Sends email notifications to the admin when a bot is detected.
- Stores data in a MySQL database for easy retrieval and analysis.## Prerequisites
- PHP 7.0 or higher
- MySQL
- Composer (for installing dependencies)
- A web server (Apache/Nginx) configured to run PHP## Installation
### 1. Install dependencies
Make sure you have Composer installed, then run:
```bash
composer install```
- install CrawlerDetect
You need to install the [CrawlerDetect](https://github.com/JayBizzle/Crawler-Detect/) library using Composer:
```bash
composer require jaybizzle/crawler-detect
```### 2. Set up the database
Create a MySQL database and run the SQL commands. Look in the `info.txt` file to create the necessary tables
### 3. Configure the project
Update the `config/config.php` file with your database connection details and admin email address.
### 4. Set up your web server
Make sure your web server is configured to serve the `public` directory. You may need to adjust the document root settings.
### 6. Access the application
Open your web browser and navigate to your server's URL followed by `/stat.php` to start monitoring bot activity.
### Additional steps:
You can test your project by running the server:```bash
php -S localhost:8000 -t public```
## Usage
Once set up, the application will automatically log bot visits to the `bot_data` table in the database and send email notifications when a bot is detected.
## Logging
Logs are stored in the `logs/bot-analytics.log` file. You can check this file for any errors or additional information about the bot detections.
## Acknowledgments
[CrawlerDetect](https://github.com/JayBizzle/Crawler-Detect/) The web used library for this project.