Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2004, 07:55 PM
pkuczaj's Avatar
pkuczaj pkuczaj is offline
 
Join Date: Dec 2003
Location: Calgary, Alberta
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Hit Tracker

I want to add a single command that will add stats about people hitting the site. I want it to trigger on ALL activity, and do an insert into the database. I have the command written, and the table created, but I need to locate a proper location in the php files to place it. I've tried global.php but it executes twice. Any suggestions?

Command:
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "hit_data (hitid, host, resolvedhost, useragent, port, referer, timestamp) VALUES (NULL, '" . $_SERVER["REMOTE_ADDR"] . "', '" . $_SERVER["RESOLVED_ADDR"] . "', '" . $_SERVER["HTTP_USER_AGENT"] . "', '" . $_SERVER["REMOTE_PORT"] . "', '" . $_SERVER["HTTP_REFERER"] . "', '" . $_SERVER["TIMESTAMP_NOW"] . "')");
Reply With Quote
  #2  
Old 05-08-2004, 03:14 AM
leitel leitel is offline
 
Join Date: Mar 2003
Location: Costa Rica
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I applaud your effort. I too have contemplated such a hack. Just haven't got to it. I find lacking in vB more robust features for understanding what interests site users/visitors. I'll stay tuned for now.

One thing occurs to me is to place the command in the form of a function with appropriate parameters in a 'include' function file. Maybe even global since it will be called globally.
Reply With Quote
  #3  
Old 05-09-2004, 06:20 AM
pkuczaj's Avatar
pkuczaj pkuczaj is offline
 
Join Date: Dec 2003
Location: Calgary, Alberta
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've currently got it running in global. But I'm finding that a single formview will generate 1 - I've seen 9 hits. Global must be used for attachments or some other sub function. I need to find a single location, or a controlling variable. If I could find the place that executes the header template that would do it.

I've further refined the insert to include then username as well, so I can further query the resulting data. My one concern at this point is the additional load on the machine.

Any thoughts?
Reply With Quote
  #4  
Old 05-09-2004, 07:21 AM
pkuczaj's Avatar
pkuczaj pkuczaj is offline
 
Join Date: Dec 2003
Location: Calgary, Alberta
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok. My latest revision. This one seems to be working. But I'm still testing it out. This is placed into the global.php file.

if (!headers_sent())
{
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "hit_data (hitid, host, username, useragent, port, referer) VALUES (NULL, '" . $_SERVER["REMOTE_ADDR"] . "', '" . addslashes($bbuserinfo['username']) . "', '" . addslashes($_SERVER["HTTP_USER_AGENT"]) . "', '" . $_SERVER["REMOTE_PORT"] . "', '" . addslashes($_SERVER["HTTP_REFERER"]) . "')");
}
Reply With Quote
  #5  
Old 09-04-2004, 10:20 PM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

global.php is included in various different php files for different functions. I'm a newb myself, but I'm guessing that with more calls to global.php, the number of times the counter increments is also incrementing. My instinct would be to put it in index.php itself since that is the first file being called.

I'm interested in what you are working on because I need to implement a counter (or thread-views type of thing) for calendar events. I need to have this developed and working by the end of this month. Some of the logic I'll be developing may be of use to you and vice-versa.
Reply With Quote
  #6  
Old 09-05-2004, 02:45 AM
pkuczaj's Avatar
pkuczaj pkuczaj is offline
 
Join Date: Dec 2003
Location: Calgary, Alberta
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The only problem being is that, if the user goes to a post or a thread directly from the e-mail notification then they bypass the index.php altogether.

Quote:
Originally Posted by SamirDarji
global.php is included in various different php files for different functions. I'm a newb myself, but I'm guessing that with more calls to global.php, the number of times the counter increments is also incrementing. My instinct would be to put it in index.php itself since that is the first file being called.

I'm interested in what you are working on because I need to implement a counter (or thread-views type of thing) for calendar events. I need to have this developed and working by the end of this month. Some of the logic I'll be developing may be of use to you and vice-versa.
Reply With Quote
  #7  
Old 09-05-2004, 04:03 PM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by pkuczaj
The only problem being is that, if the user goes to a post or a thread directly from the e-mail notification then they bypass the index.php altogether.
True. The challenge of what you want is you want it triggered on all activity. Technically, when global.php was indicating multiple hits that was all activity since many different calls to global.php were required. The difficult thing is there will have to be conditionals that help determine when a particular hit is valid to count or needs to be disregarded.

I'm sure some of this logic must exist in vbulletin itself since thread views cannot be artificially inflated by simply hitting refresh.
Reply With Quote
  #8  
Old 09-05-2004, 05:39 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

running such a query on a large board can become database and server intensive which is not advised for webmasters who run their forums on shared hosting
Reply With Quote
  #9  
Old 09-05-2004, 06:32 PM
pkuczaj's Avatar
pkuczaj pkuczaj is offline
 
Join Date: Dec 2003
Location: Calgary, Alberta
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would agree the logic does exist, but I just haven't found it. (I haven't looked in a while either)

Quote:
Originally Posted by SamirDarji
True. The challenge of what you want is you want it triggered on all activity. Technically, when global.php was indicating multiple hits that was all activity since many different calls to global.php were required. The difficult thing is there will have to be conditionals that help determine when a particular hit is valid to count or needs to be disregarded.

I'm sure some of this logic must exist in vbulletin itself since thread views cannot be artificially inflated by simply hitting refresh.
Reply With Quote
  #10  
Old 09-05-2004, 06:39 PM
pkuczaj's Avatar
pkuczaj pkuczaj is offline
 
Join Date: Dec 2003
Location: Calgary, Alberta
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I do run a large board. I get about 8,500-9,000 posts a day. I did have the previous hit counter script running on the board, but with the duplicate hit problem I wrote another little application that does the hit counting for me. It's more accurate because it's only included in the footer.

The hit counting it intense, but it's worth the trouble and the load because it justifies banner advertising, and it's information that's required to do that.

My Linux AMD 3000 is currently running at a top static of a load average of 5-6 as peak times spiking to 12-15 at times. I'm currently in the process of aquiring a SCSI Ultra 320 drive and controller in hopes that it relieves some of the load on the box. If that doesn't work then I need to go with a dual processor box.

Quote:
Originally Posted by AN-net
running such a query on a large board can become database and server intensive which is not advised for webmasters who run their forums on shared hosting
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05056 seconds
  • Memory Usage 2,258KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete