In order to record the categories and products browsed by a customer in her profile during a given visit to Pioneer Cycling, we added two transient properties to the visitor’s profile: categoriesViewed
and productsViewed
. We defined these properties as transient to avoid collecting and storing extraneous information in the database. They can be seen in the following XML excerpt from PioneerCycling/config/atg/userprofiling/userProfile.xml
.
Note: The “. . .” markers in the following code sample indicate a place where code has been removed to clarify the sample.
<item-descriptor name="user"> . . . <!-- These transient properties used to record categories & pages viewed --> <property name="categoriesViewed" display-name="Categories viewed recently" data-type="set" component-data-type="String" /> <property name="productsViewed" display-name="Products viewed recently" data-type="set" component-data-type="String" /> . . . </item-descriptor>
To record the categories and products viewed by a member during a visit to the Pioneer Store site, we needed to generate a DMS (Dynamo Messaging System) message each time a category or product is viewed, and record that message in the member’s profile. We used the Commerce component /atg/commerce/catalog/CategoryBrowsed
, as shown below, to generate the DMS message when a category is viewed.
… <dsp:droplet name="/atg/commerce/catalog/CategoryLookup"> <dsp:param bean="/OriginatingRequest.requestLocale.locale" name="repositoryKey"/> <dsp:oparam name="output"> <%/* Send a Views Item event that we browsed this category */%> <dsp:droplet name="/atg/commerce/catalog/CategoryBrowsed"> <dsp:param name="eventobject" param="element"/> </dsp:droplet> </dsp:droplet> …
CategoryBrowsed
is invoked by the following pages:
catalog/category_all_bikes.jsp
catalog/category_bikes.jsp
catalog/category_bundle.jsp
catalog/category_clothing.jsp
catalog/category_generic.jsp
catalog/category_parts.jsp
A DMS message is sent by the component /atg/commerce/catalog/ProductBrowsed
when the site visitor views a product. It is invoked as follows:
. . . <dsp:droplet name="/atg/commerce/catalog/ProductLookup"> <dsp:param bean="/OriginatingRequest.requestLocale.locale" name="repositoryKey"/> <dsp:param name="elementName" value="Product"/> <dsp:oparam name="output"> <%/* Add this product to the user's list of products browsed. */%> <dsp:droplet name="/atg/commerce/catalog/ProductBrowsed"> <dsp:param name="eventobject" param="Product"/> </dsp:droplet> </dsp:droplet> . . .
ProductBrowsed
is invoked by the following pages:
catalog/product_bike.jsp
catalog/product_bundle.jsp
catalog/product_generic.jsp
catalog/product_gift_certificate.jsp
catalog/product_part.jsp
The messages generated by these components are received by the Scenario Server. We created a Pioneer Cycling Store scenario named Browsing to accept ItemViewed
messages. It acts on incoming messages by updating the user’s profile accordingly as shown below:
The DMS messages generated by CategoryBrowsed
and ProductBrowsed
are of type atg.dps.ViewItem
. The Patch Bay definition file, /atg/dynamo/messaging/dynamoMessagingSystem.xml
is used to deliver these messages to the Scenario Server. The components are defined as message sources in the Commerce configuration layer, and the Scenario Server is defined as a message sink in the User Profiling configuration layer.
For more about scenarios, see the Creating Scenarios chapter in the ATG Personalization Guide for Business Users.