Gossamer Forum
Quote Reply
Total Hits
Hi there,

Can anyone let me know if there is a way to view the total hits out from SQL on a daily basis? If not can someone tell me where the hits are generated. maybe i could produce a small mod that will let you know from admin or something..




Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Total Hits In reply to
The Hits are generated in the Hits_Track table and also in the Build_Updates table. What you would have to do is re-write the nph-build.cgi to store values in another field possibly in the Links table or a tmp table that shows total daily hits.

Regards,

Eliot

Quote Reply
Re: Total Hits In reply to
So let me se if i've got this right,

I could send the hits for each link to a column in a table then, run a simple add column command, Then import the total to a file and display them??

I'm not savvy with this, but is this the general idea?



Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Total Hits In reply to
Sort of....a bit more involved...but on the right track.

Wink

Regards,

Eliot

Quote Reply
Re: Total Hits In reply to
The hits are already counted in the hits_track table.

You would need to do a pre-scan of that table in nph-build.cgi BEFORE you empty the table, to add up the column of hits (that may be a single SQL command, my desk is a mess -- new computer & network devices being added -- so I can't check right now).

But, then you would take that value you get, and store it in a new table called "Daily_Hits" or something like that. It's much easier to use the Links routines, so you'd want a table "ID,Date,Hits" with ID indexed as primary.

You could make the "Date" field a time-stamp, and when you inserted the record, the only value you'd have to supply is the total hits to the "Hits" column, MySQL would add the next ID and the current date/time for you.

Not hard, probably 4-5 lines of code at the top of nph-build.cgi, plus creating the new table and the new "Daily_Hits.def" file.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Total Hits In reply to
Caveat -- this would record the number of hits between builds. If you really, really wanted to record the #-hits on any given day, you need to use a set of tables similar to the way I tracked the "Top-N search words" on any day. You need to key on "date" as well as "link" to do that, and when the date changes, you get a new entery ie: the primary index is LinkID+Date, not just LinkID or Date.

Make sense??

Check out the forum for the Top-n search terms code for an example.

I don't think it got posted in the resource center.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/