The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
|
Visitor Info Log - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11) +--- Thread: Visitor Info Log (/showthread.php?tid=8002) |
Visitor Info Log - jwzumwalt - 2016-02-17 I thought it might be interesting to share with other folks how I am tracking my site visitor info. Place the following code at the begining of the root directory index.php file. PHP Code: /* +-----------------------------------------------------------------+ Each time your site is visited, it will enter visitor information into a file in the root directory called "visitor.log". A typical entry looks like this... 2016.02.17 07:15:19 {"ip":"67.61.123.28","country_code":"US","country_name":"United States","region_code":"OR","region_name":"Oregon","city":"Ontario","zip_code":"97914","time_zone":"America/Boise","latitude":44.0861,"longitude":-117.0188,"metro_code":757} One word of caution before everybody gets all excited. The lookup time to this public database is about 3 seconds, so there is some page load latency . During high internet usage, this free db may return blank or report "try again later" My logs show about 1 out of 10 requests fail. And they may fail for periods of 2-3 minutes when I am testing. This "Jason" data dump can be manipulated by a spreadsheet, database, or custom PHP program. At some time in the future I will probably write a custom analysis program in PHP. I use it to see daily activity and I find the the country of origin fascinating. I do not know how to make plugins and don't expect to take the time to learn. But, if someone wants to take the time to convert this to a plugin, I would willingly contribute a db analysis. A couple of enhancements that some folks might want is to limit the file size by date or size. Since I regularly do backups and ftp into my site, I regularly reset the file. To trim the file to a certain number of lines, this routine can be used. Code: // trim file size RE: Visitor Info Log - Charpy1 - 2016-02-18 Thanks for sharing! Yeah it could be very nice to have this informations somewhere on the backend panel. I'm using a Piwik instance to have these information but a little plugin like this could be just fine. RE: Visitor Info Log - elubben - 2016-02-19 Placed the code into my index.php file, and the only data that I get is 2016.02.17 07:15:19. The other data would be great and I'm wondering if I may have done something wrong? Gene RE: Visitor Info Log - jwzumwalt - 2016-02-19 (2016-02-19, 06:12:45)elubben Wrote: Placed the code into my index.php file, and the only data that I get is 2016.02.17 07:15:19. The other data would be great and I'm wondering if I may have done something wrong? Thanks for the reply... no there is nothing wrong. This is a good question and I should have explained this. During high internet usage, the db will be blank or report "try again later" When I look at my log, about 1 out of 10 requests fail. And they may fail for periods of 3-4 minutes when I am testing. I do not know who maintains this free service but it is the only one I know about. Other companies that provide this service charge for each access. So, this is the best I have come across. Sorry I did not make this clear - I will edit my original post. RE: Visitor Info Log - elubben - 2016-02-19 (2016-02-19, 06:21:57)jwzumwalt Wrote:Great, it's working then!!! Thought I did something wrong in pasting to my index.php(2016-02-19, 06:12:45)elubben Wrote: Placed the code into my index.php file, and the only data that I get is 2016.02.17 07:15:19. The other data would be great and I'm wondering if I may have done something wrong? Gene |