Tutorials > Management Center > Track and displaying the most viewed recipes

< Previous | Next >


Define a new marketing action to track and display the most viewed recipes

In this tutorial, we will customize a new action to display the top viewed recipes, so define an action template. The template definitions are stored in XML format in the DMELETEMPLATE table.

In the Activity Builder palette, each trigger, target, and action that a business user can add to a marketing activity is a campaign element. The campaign element used in marketing activities is based on templates. The templates are called campaign element template definitions. Campaign element template definitions define the blueprint for campaign elements. Each campaign element in the palette can be associated to one or more template definition.

The implementation definition is an XML fragment in a campaign element template definition. All actions must have an implementation definition. The purpose of the implementation definition XML segment for an action is to:

  1. Specify the unique name of the campaign element template for the recipe_Ranking_MostBrowsed action.

  2. Specify the task command associated with the action:

    RecipeTopViewedCmd

    A new task command created in later steps for capturing the viewed recipe information in the statistic table.

    DisplayTopViewedRecipesActionTaskCmd

    A new task command created in later steps for displaying top viewed recipes.
    These task commands are created in later steps of this tutorial.

  3. Specify the campaign element template parameters to pass to the task command, including creating a new business policy ID (-9003) for generating the daily recipe ranking list.

    For an action, the parameters define what to do, for example, display content in an e-Marketing Spot. The following is the action template definition:

    <FlowElementImplementation type="RecipeRankingBrowsed"> 
    <Implementation invocationType="TaskCommand"> 
    <Class name="com.mycompany.commerce.project.marketing.DisplayTopViewedRecipesActionTaskCmd"> 
    <Argument name="objectGroupId" value="MARKETING_objectGroupId"/> 
    <Argument name="size" value="MARKETING_size"/> 
    <Argument name="location" value="MARKETING_location"/> 
    <Argument name="intervalUnit" value="MARKETING_intervalUnit"/> 
    <Argument name="intervalNum" value="MARKETING_intervalNum"/> 
    <Argument name="policyId" value="-9003"/> 
    </Class> 
    </Implementation> 
    </FlowElementImplementation> 
    
    


    insert into dmeletemplate (dmeletemplate_id,dmelementtype_id,name,implxml,behaviorxml) values(400,3,'recipe_Ranking_MostBrowsed', '<FlowElementImplementation type="RecipeRankingBrowsed">
    <Implementation invocationType="TaskCommand">
    <Class name="com.mycompany.commerce.project.marketing.DisplayTopViewedRecipesActionTaskCmd">
    <Argument name="objectGroupId" value="MARKETING_objectGroupId"/>
    <Argument name="size" value="MARKETING_size"/>
    <Argument name="location" value="MARKETING_location"/>
    <Argument name="intervalUnit" value="MARKETING_intervalUnit"/>
    <Argument name="intervalNum" value="MARKETING_intervalNum"/>
    <Argument name="policyId" value="-9003"/>
    </Class>
    </Implementation>
    </FlowElementImplementation>', '<BehaviorRule command="RecipeDisplay" action="custom" callCmdOnMatch="com.mycompany.commerce.project.marketing.RecipeTopViewedCmd">
    <Variable name="collectionId" value="MARKETING_objectGroupId" type="NVP"/>
    </BehaviorRule>'); 
    
    

    Where:

    <FlowElementImplementation> type

    This is the unique name of the template for this action.

    <Implementation> invocationType

    This value is always TaskCommand.

    <Class> elements

    Each action has an associated task command. This must be a class that implements the MarketingCampaignElementTaskCmd interface. In this tutorial. We define the associated task command DisplayRecipeRankingActionTaskCmd for displaying top viewed recipes.

    <Class> name

    The DisplayRecipeRankingActionTaskCmd command we defined. It should be the full name, including the package name.

    <Argument> element

    The implementation definition XML can have zero or more of these campaign element template parameters. When a customer reaches a target or action element in a marketing activity, the marketing services pass the parameters to the campaign element task command. The task command retrieves the parameters using the getElementParameters method and then uses the parameters to evaluate the target or perform the action.

    <Argument name="objectGroupId" value="MARKETING_objectGroupId"/>

    A required value for which recipe collection to display. The value is from the Recipe Collection grid when creating a Web activity in Management Center.

    <Argument name="size" value="MARKETING_size"/>

    A required value for the number of recipes to display in the list. The value is from the Maximum number list when creating a Web activity in Management Center.

    <Argument name="location" value="MARKETING_location"/>

    A required value for location to determine which ranking list to display. The value is from the Display list when creating a Web activity in Management Center.

    <Argument name="intervalUnit" value="MARKETING_intervalUnit"/>

    A predefined value set to D to specify that the time frame interval is in days.

    <Argument name="intervalNum" value="MARKETING_intervalNum"/>

    A required value for the number of days in the timeframe interval. The value is from the Time frame in days list when creating a Web activity in Management Center.

    <Argument name="policyId" value="-9003"/>

    The business policy relating to this action. It is used to generate and clean up rankings. It is defined in a later lesson, Calculating the top viewed recipes from the statistics data.

    For the action template, you need a behavior rule definition. The behavior rule definition specifies how to detect when a customer has viewed a recipe. A custom task command must be called when a customer views a recipe to update the statistics database table. The statistics table is analyzed once per day to generate the top viewed recipe list. For this action template, the behavior rule definition is:

    <BehaviorRule command="RecipeDisplay" action="custom" callCmdOnMatch="com.mycompany.commerce.project.marketing.RecipeTopViewedCmd"> 
    <Variable name="collectionId" value="MARKETING_objectGroupId" type="NVP"/> 
    </BehaviorRule>
    

    When the shopper runs the RecipeDisplay view, the com.mycompany.commerce.project.marketing.RecipeTopViewedCmd task command is invoked. This commend is responsible for recording how many times the recipe has been viewed. This command is created in later tutorial steps.


Procedure

  1. Start the WebSphere Commerce test server.

  2. Open a new browser window and enter the following URL:

  3. In the text box, enter:

    insert into dmeletemplate (dmeletemplate_id,dmelementtype_id,name,implxml,behaviorxml) values(400,3,'recipe_Ranking_MostBrowsed', 
    <FlowElementImplementation type="RecipeRankingBrowsed"> 
    <Implementation invocationType="TaskCommand"> 
    <Class name="com.mycompany.commerce.project.marketing.DisplayTopViewedRecipesActionTaskCmd"> 
    <Argument name="objectGroupId" value="MARKETING_objectGroupId"/> 
    <Argument name="size" value="MARKETING_size"/> 
    <Argument name="location" value="MARKETING_location"/> 
    <Argument name="intervalUnit" value="MARKETING_intervalUnit"/> 
    <Argument name="intervalNum" value="MARKETING_intervalNum"/> 
    <Argument name="policyId" value="-9003"/> 
    </Class> 
    </Implementation> 
    </FlowElementImplementation>
    '<BehaviorRule command="RecipeDisplay" action="custom" callCmdOnMatch="com.mycompany.commerce.project.marketing.RecipeTopViewedCmd"> 
    <Variable name="collectionId" value="MARKETING_objectGroupId" type="NVP"/> 
    </BehaviorRule>');
    

    This definition is similar to the definition used for Top Browsed products, where the policyId is matched with a policy being created later in this tutorial.


Related concepts

Campaign element template definitions

Campaign element task commands

Campaign element template parameters

Implementation definition: for targets and actions

Behavior rule definition

Rank list framework for marketing actions


Related tasks

Create the campaign element template definition

< Previous | Next >


+

Search Tips   |   Advanced Search