APEXtras

a development team dedicated to Oracle APEX

Page visit logging

with 2 comments

APEX has the ability to log and analyse user activity in some detail. However, the unit of the built-in APEX logs is the APEX page, and the data collected about what a user does on a particular page is limited. In many of our APEX applications, a single APEX page may correspond to multiple web pages. For example we have implemented a dynamic questionnaire system in which each screen of the questionnaire is rendered on the same APEX page. A PL/SQL routine is called with a parameter representing the page of the questionnaire that should be displayed which outputs the complete questionnaire screen by htp.p calls. We still need to collect information about “page” visits although only one APEX page is involved. In addition, there is often a requirement to collect more detailed information about how people are using the system – search terms entered, number of checkboxes ticked, etc.

The solution is to build your own page logging system that inserts a row into a log table for every page visited. You can then record any sort of detail you like. We call the logging code as an Application Process at Process Point “On Load: Before Header (page template header)”. Because APEX doesn’t provide a built-in variable that records the current page alias (and we use page aliases throughout our system), we also need a Before Header Application Computation that fills the Application Item APP_PAGE_ALIAS (see http://oraclequirks.blogspot.com/2008/02/build-and-use-apex-page-alias.html).

The actual insert into the log table is a simple SQL statement that could be executed in the APEX process, but we prefer to keep code that writes to tables in PL/SQL packages, separate from APEX: it’s more maintainable there, error handling can be more rigorously enforced, and we end up with a single PL/SQL procedure to perform each action, rather than several APEX PL/SQL regions doing more-or-less the same thing.

Written by Roger

February 25th, 2009 at 3:52 pm

Posted in Uncategorized

Tagged with , , ,

2 Responses to 'Page visit logging'

Subscribe to comments with RSS or TrackBack to 'Page visit logging'.

  1. You can also use google analytics in addition, it gives you a whole lot more about your visitors including geographical regions, browsers versions, check it out…

    Sujay

    5 Mar 09 at 22:18

  2. I’m not sure that would do what we needed – we wanted detailed information about the activities of our logged-in users who were not navigating between different APEX pages, but were viewing different data rendered on the same page.

    Roger

    6 Mar 09 at 15:57

Leave a Reply