You can use the atg.userprofiling.ViewItemEventSender
servlet bean to send JMS messages when the customer views items in the catalog. ViewItemEventSender
sends a JMS object message of class atg.userprofiling.dms.ViewItemMessage
. The ViewItemMessage
object identifies the repository item being viewed and the item’s location. These messages can be used to trigger actions. For example, a message listener could be configured to store information in the customer’s profile about the products viewed.
The ViewItemEventSender
takes a single input parameter called eventobject
that specifies the item viewed. There are no output parameters or open parameters.
ATG Commerce includes two ViewItemEventSender
components in /atg/commerce/catalog
: ProductBrowsed
and CategoryBrowsed
. Depending on which one you use, the eventobject
passed in is either the product or category repository item.
The following example shows a portion of a JSP that uses the ProductBrowsed
component to send a message when a product is viewed. The product’s repository ID is passed to this page (via the itemId
parameter) from the page that links to it:
<dsp:droplet name="/atg/commerce/catalog/ProductLookup"> <dsp:param param="itemId" name="id"/> <dsp:oparam name="output"> <dsp:droplet name="/atg/commerce/catalog/ProductBrowsed"> <dsp:param param="element" name="eventobject"/> </dsp:droplet> </dsp:oparam> </dsp:droplet>