|
Spicy Scenario ExampleOverviewThis article demos a simple scenario, assuming the following:
The ScenarioWe write and enable a simple scenario which fires whenever a user views a pizza recipe. In that case we adjust the users spice factor by the spicyness of the pizza. That way we can later suggest pizzas they might like.
JHTMLThe Source Code to display all the pizzas and the display a pizza the user chooses on the same page. This should cause the scenario to fire, then we can see the changes in the user's spice adjustment. Notice that the fireContentTypeEvent and fireContentEvent flags are set to false in the ForEach and true at the point where we actually display the item based on the users seleciton.
<DECLAREPARAM NAME="recipe_id" CLASS="java.lang.String" DESCRIPTION="" OPTIONAL >
<IMPORTBEAN BEAN="/atg/userprofiling/Profile">
<HTML> <HEAD>
<TITLE>All Pizzas</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1><A HREF="demo_spicy_scenario.jhtml">All Pizzas</A></H1>
<DROPLET BEAN="/atg/dynamo/droplet/IsEmpty">
<OPARAM NAME="false">
<DROPLET BEAN="/atg/targeting/RepositoryLookup">
<PARAM NAME="repository"
VALUE="bean:/PWA/Pizzaland/ContentRepositories/PizzaRecipeRepository">
<OPARAM NAME="output">
You selected : <VALUEOF PARAM="element.recipeName"></VALUEOF>
</OPARAM>
<PARAM NAME="id" VALUE="param:recipe_id">
</DROPLET>
</OPARAM>
<PARAM NAME="value" VALUE="param:recipe_id">
</DROPLET>
<p>Based on your habits, your current spice factor is
<VALUEOF BEAN="Profile.spiceFactor">unset</VALUEOF></p>
<DROPLET BEAN="/atg/targeting/TargetingForEach">
<PARAM NAME="targeter"
VALUE="bean:/atg/registry/RepositoryTargeters/PizzaRecipes/AllRecipesTargeter">
<PARAM NAME="sortProperties" VALUE="+spiceAdjustment">
<PARAM NAME="fireContentEvent" VALUE="false">
<PARAM NAME="fireContentTypeEvent" VALUE="false">
<OPARAM NAME="output">
<li><A HREF="demo_spicy_scenario.jhtml">
<PARAM NAME="recipe_id" VALUE="param:element.repositoryId">
<VALUEOF PARAM="element.recipeName"></VALUEOF>
: Spice Factor(<VALUEOF PARAM="element.spiceAdjustment">0</VALUEOF>)</A>
</li>
</OPARAM>
</DROPLET>
</BODY> </HTML>
User Experience
|
|