Re: ECommerce Customer Tracking
| From: | Jason G. | Date: | Fri, 12 Oct 2001 08:42:27 +0000 |
| Subject: | Re: ECommerce Customer Tracking | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70904@lists.php.net to get a copy of this message | ||
I Have.
Basically, I have a user_id available on each script (from a logged in user) that comes from session management.
I have a MySQL table that has the following columns:
table stat_log:
stat_id - int unsigned not null auto_increment primary key
user_id - int unsigned not null (indexed)
action_type_id - tinyint unsigned not null (indexed)
cpudate - int unsigned not null (indexed) for use with UNIX_TIMESTAMP()
additional_data - varchar(127) not null
you have a definition of stat types such as
1 = logged in
2 = executed search
3 = visited page
4 = ...
Have a function for recording a stat:
function RecordStat($nUserID, $nStatID, $sAdditionalData = '')
just insert a record into the stat_log table that has the user_id, stat_id, unix_timestamp(), and if they visited a page, put the page name in additional_data, if they did a search, put the search string in the additional_data... you get the point.
From this table, you can quickly determine alot about a user's actions.
BTW, this table grows pretty fast, but - who cares - disk space is cheap now. Besides, your average record length will maybe be 4+4+1+? = 20 bytes or so, depending on how much additional_data you put in...
mysql> select count(*) from stat_log;
+----------+
| count(*) |
+----------+
| 32320 |+----------+ 1 row in set (0.02 sec) Hope it helps! -Jason Garber IonZoft.com At 09:05 AM 10/12/2001 +0100, Girish Nath wrote:
Hi As part of a shopping site project, i've been asked by my client about "customer tracking". Things like keeping a log of specific customer's actions once they've logged in, which pages they went to, what search keywords they used, if it resulted in a purchase etc. Ideally, i'd like to output all of that info in a report for their marketing/sales department to use. Has anyone implemented/experience of this ? Any ideas are welcome :) Thanks Girish -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net