Anybody know of a good one? One that tells where they came from and when they exit.

I have been trying a few out that I got off of hotscripts and haven't found one I like.

If possible I would like to put in root directory without having a script on each page. Also would like to keep track of other sites also. I use godaddy hosting. (mysql php)

Any suggesions appreciated.

Dani AI

Generated

Several good answers already: pointed to hosted JS analytics, described using an include, and mentioned third‑party stats. Below are practical, low‑effort alternatives that meet the original constraints (put files in the root, avoid editing every page, run on PHP/MySQL hosting).

A lightweight, server‑side approach that needs no per‑page edits is to register a single PHP file to run automatically for every PHP request using PHP’s auto_prepend_file (set in php.ini, .user.ini or .htaccess depending on your host). That file can log: timestamp, remote IP, requested URI, referrer header, user agent and a session cookie. Store rows in a simple MySQL table and derive “exit” pages by grouping hits into sessions (e.g., 30‑minute inactivity = session end) and taking the last URI in each session.

Example config lines you can try (host support varies):

# when allowed for mod_php
php_value auto_prepend_file "/home/youruser/public_html/track.php"

Example minimal table structure to log hits:

CREATE TABLE page_hits (
  id INT AUTO_INCREMENT PRIMARY KEY,
  session_id VARCHAR(64),
  site_id VARCHAR(32),
  ip VARBINARY(16),
  referrer TEXT,
  uri TEXT,
  ts DATETIME
);

If many pages are static HTML, either enable PHP parsing for .html (so the above tracking runs) or use server log analysis (AWStats/Webalizer) which reads raw access logs and requires no page changes. For accurate “exit” events, client‑side code (onbeforeunload/heartbeat) captures immediate leaves, but it needs a script on pages — otherwise infer exits from session timeouts server‑side.

Troubleshooting notes: some shared hosts block php_value in .htaccess; check phpinfo() or your hosting docs and try .user.ini or a custom php.ini. Be mindful of privacy/legal rules when logging IPs or cross‑site tracking; use a site_id field if you’ll aggregate several domains into one DB.

Recommended Answers

All 5 Replies

Use Google Analytics it will give you tons of information which you will most likely not need but it generates pretty pictures and it doesn't take up any space on your servers

If possible I would like to put in root directory without having a script on each page

I used the "include" statement to get a counter on all of my pages. Is that what you are after for?

I used the "include" statement to get a counter on all of my pages. Is that what you are after for?

Not really, I just want to put a file or two on the site, without having to add code to each page. I add regularily to many of my sites, and I also don't want to go back and add to all of the others.

I really am not a coder, but have been going in and changing some of the obvious stuff here and there in some of my templates and index pages.

I have the google account, hmm, may have to look at that some, but some of my sites will never see a google ad so will that work for them?

Im getting ready to generate a bunch of web pages using my photos, and an include might be cool, how does that work? Would I need to have a good counter/stats program for it to work?

Include works be inserting a file into another ie.,

HelloWorld.php

<?php
echo "<h1>Hello World!</h1>\n";
?>

index.php

<html>
<head>
<title>Hello</title>
</head>
<body>
<? include('Hello World.php'); ?>
</body>
</html>

Would generate a page that looks like this:

<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>

Obviously it can have more than one echo but that's the easiest way to describe it.

A great web stats option is GoStats. I use both Google and GoStats to get a hybrid solution of realtime and comprehensive web stats. (GoStats is really quite good even by itself)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.