Adding the session_id to JBOSS and the ATG order repository

We wanted to be able to track the path a shopper took through the initial order creation process in ATG. The IP address is often insufficient for reasons such as a shared internet connection, proxy server, etc.

We extended the order repository and CartFormHandler class to handle our session id. We then added the column to our custom order extension table. We also added the %S directive to JBOSS access log valve configuration so it would be written in the access log. Using this, we can tie the access log to the database, and the access log to the server log to determine the impact of any errors. In other words, if we have tons of INCOMPLETE orders and can directly tie them back to a specific session, and take a thread in that session and tie it to an error on that thread in the server.log, we can indirectly calculate the financial impact of errors.

We are also considering just writing the order_id and sessionid in the server.log, as it will change as different sessions work on the order. In our case, we are only interested in the initial order process. The server.log would be less work and space used in the database.

For now, we are starting with this, though.

Order repository…

  
  
    
    
    

Snippet of added setter/getter methods in the extended OurOrderImpl class…

        public String getSessionId() {
                return (String) getPropertyValue(SESSION_ID);
        }

        public void setSessionId(String pSessionId) {
                setPropertyValue(SESSION_ID, pSessionId);
        }

Snippet of extended OurCartFormHandler class…

  protected void doAddAsSeparateItemsToOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws ServletException, IOException {
    if (isLoggingDebug())
      logDebug("Starting doAddItemsToOrder");

    // Fetch the order
    Order order = getOrder();
    ((OurOrderImpl) this.getOrder()).setSessionId(pRequest.getSession().getId());
    if (order == null) {

…and database…

alter table atg_core_prod.our_order add session_id varchar2(64);

…results in…

SESSION_ID	ORDER_ID	PROFILE_ID	STATE
7B79F5ADAEE7B820EADCF0F3C09CF6EA	EXP285050152ATL	u329510147ATL	SUBMITTED
789A0F47E4199282417E41E23070D6AB	EXP285190104ATL	u329650016ATL	INCOMPLETE

…and in the access log…

1.1.1.1 - [23/Aug/2013:09:03:46 -0400] "POST /catalog/gadgets/color_size_gadget.jsp HTTP/1.1" http-172.28.72.10-10180-9 789A0F47E4199282417E41E23070D6AB 200 5253 16
1.1.1.1 - [23/Aug/2013:09:03:54 -0400] "POST /catalog/actions/cart-submit.jsp?mTAS=3704080 HTTP/1.1" http-172.28.72.10-10180-6 789A0F47E4199282417E41E23070D6AB 302 5 149
1.1.1.1 - [23/Aug/2013:09:03:55 -0400] "GET /catalog/urls/cart-submit-success.jsp?_requestid=350 HTTP/1.1" http-172.28.72.10-10180-9 789A0F47E4199282417E41E23070D6AB 200 26 24
1.1.1.1 - [23/Aug/2013:09:03:55 -0400] "POST /checkout/gadgets/minicartcontents.jsp HTTP/1.1" http-172.28.72.10-10180-6 789A0F47E4199282417E41E23070D6AB 200 3532 135
1.1.1.1 - [23/Aug/2013:09:03:56 -0400] "GET /static/img/buttons/ima-quickview-close.gif HTTP/1.1" http-172.28.72.10-10180-10 789A0F47E4199282417E41E23070D6AB 304 - 6
1.1.1.1 - [23/Aug/2013:09:03:56 -0400] "GET /includes/shoppingCartItemCount.jsp?returnVar=yes&_=1377223436811 HTTP/1.1" http-172.28.72.10-10180-9 789A0F47E4199282417E41E23070D6AB 200 11 14

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.