PHP Classes
elePHPant
Icontem

PHP Visitor Tracking: Track visitor location and details using MySQLi

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (158)   DownloadInstall with Composer Download .zip   Reputation   Support forum (6)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2015-11-11 (11 months ago) RSS 2.0 feedStarStarStarStar 60%Total: 902 This week: 2All time: 3,768 This week: 591Up
Version License PHP version Categories
php-visitor-tracking 1.21Freeware5.0HTML, PHP 5, Databases, Geography
Description Author

This class can track visitor location and details using MySQLi.

It records the details of a site visitor inserting a record in a MySQL database using MySQLi.

The class looks up the user IP address using the NetIP.de Web service to retrieve the user country, domain, state and town name.

It also records in the database the current page the user is visiting, the referrer page and the current date.

The class can also display on a Web page a paginated listing of the latest visitors details.

Recommendations

how to retrieve user ip address from the database
retrieve user ip address from the database

Picture of Tyler Heshka
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

Details

visitorTracking

GitHub License Software Version Github Downloads

visitorTracking is a simple PHP class to gather visitor information, and store it in a database using MYSQLi. It's more modern and complete than others I have seen around on Google/HotScripts. (SQLi, oop(ish?), etc...) No bells or whistles, fully customizable.

Download

Old Versions

Documentation

http://tyrexi.us/visitorTrackingDocumentation

Demo

http://tyrexi.us/visitorTracking

Install

  1. Upload the files to your server.
  2. Edit the database configuration ( src/_installation/db.php )
  3. Create the visitors table in your database. (src/_installation/visitors.sql )
  4. Instance the class in your code.

Usage

//define database
define( 'DB_HOST', 'localhost' );           // set database host
define( 'DB_USER', 'root' );                // set database user
define( 'DB_PASS', '' );                    // set database password
define( 'DB_NAME', 'yourdatabasename' );    // set database name

//include the class
include( 'src/class.visitorTracking.php' );

//instance the class
$visitors = new visitorTracking();

The constructor method automatically calls the tracking method $visitors->track(); which inserts the collected data.

You print the array containing the current visit by echoing $visitors->displayThisVisit();

You can output a table containing all the paginated data from the database by echoing $visitors->displayVisitors();

Alternatively, you can just grab the table data from your database SELECT * FROM visitors ORDER BY date DESC and format it according to your specifications.

License

This project is licensed under the MIT LICENSE

Contributors

Contributors on GitHub

Contributing

If you would like to help make this software better, please follow our guidelines found in CONTRIBUTING.md

Contact

  • Homepage: http://heshka.com
  • E-mail: tyler@heshka.com
  • KeyBase: https://keybase.io/theshka
  Visitor Tracking DemoExternal page  
Screenshots  
  • Screenshot1
  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)
Files folder imageincludes (1 directory)
Accessible without login Plain text file index.php Example Displays the class
Accessible without login Plain text file LICENSE Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 99%
Total:902
This week:2
All time:3,768
This week:591Up
User Ratings User Comments (3)
 All time
Utility:87%StarStarStarStarStar
Consistency:85%StarStarStarStarStar
Documentation:-
Examples:77%StarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1142
 
there is no steps & library in folder
3 months ago (Brijesh Dhami)
0%Star
Does not work, because 2 database fields are missing.
1 year ago (manfred)
65%StarStarStarStar
great help traking users
1 year ago (Gerardo Rios)
80%StarStarStarStarStar