[ic] Track Product Views

Andrew Metcalfe interchange-users@icdevgroup.org
Fri Sep 6 11:57:02 2002


> You could even take it a step farther, create a table called
> reports, and put a query on flypage like this:
>
> create table reports (
> userid varchar(32)
> sku    varchar(32)
> date 	 dateTime
> }


Oops.  The create table shouldn't be on flypage.  The [query] below should
be on flypage... I just included the create table FYI.

_Am

>
> [query st=db sql="insert reports
> userid, sku, date
> values('[userdb userid]','[convert-date raw=1][/convert-date]', )
> date = '[convert-date raw=1][/convert-date]','[item-code]')
> "]
>
> Then you could query based on a certain timeframe, or per users,
> or number of times viewed before purchasing, etc.  This table
> will grow quite large, so make sure you have it indexed properly.
>
> I'm not really sure about the capabilities of mySQL, but in
> oracle you could do something like:
>
> select count(userid,sku) from reports
> group by userid,sku
> having date > '01/01/02'
> order by count(userid,sku) desc;
>
> which would give you a report of how many times a user viewed a
> certain product in 2002, ordered by number of views.
>
> You'll find the more comfortable you get with SQL, you'll find
> it's an incredibly powerful tool for managing and reading data.
>
> _Am