Jump to content

PHP Web Analytics Script

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
adzeds

adzeds

    Newbie

  • Members
  • PipPip
  • 27 posts
Ok. Here is the deal:
I am trying to capture my website statistics using a PHP script so that I can access the mySQL database using a desktop app to analyze the stats!

I am creating my PHP script now to record the data.

I know how to collect:
access_time
ip address
referrer
search engine domain
search engine query
page accessed

How do I collect?:
avg time on site
avg pages per visit
traffic type (referral,search engine,direct)

I am including a PHP script into a site to collect the data.

Hope someone can help!

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
hm.. you can get a traffic type like..

If referral is "google", "bing" or whatever.. then traffic type is "search engine".
if referral is not search engine then it's just "referral"
if there is no referral then it's direct..

I believe it goes like this.. but um.. average times I don't know :/

#3
adzeds

adzeds

    Newbie

  • Members
  • PipPip
  • 27 posts
Thanks for the advice!

Just need to work out how to calculate time on site!

#4
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Time on site youd calculate by one page to another.

Quote

User1, page1, 1:00
User1, page2, 1:02
User1, page3, 4:06

The first two would be one visit since the time between pages is 2 minutes, but the last is it's own visit since it's hours away. I'd make the max time like 5-10 minutes.

#5
Guest_Jaan_*

Guest_Jaan_*
  • Guests
I believe you can do something with sessions.. hmm