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

< Previous | Next >


Calculate the top viewed recipes from the statistics data

A business policy is used to define how to generate the rankings. A ranking type relating to a ranking policy contains two BusinessPolicyCommands: CleanupRankingPolicyCmdImpl and GenerateRankingPolicyCmdImpl. CleanupRankingPolicyCmdImpl cleans and summarizes the ranking statistics data. The purpose of using this command is to delete the out-of-date data that is no longer required and to summarize the data into the reduced database rows, helping control the size of the DMRANKINGSTAT statistics table. The cleanup command must implement the CleanupRankingPolicyCmd interface. Another command, GenerateRankingPolicyCmdImpl, evaluates the statistics data and generates the corresponding ranking list. This command analyzes the existing statistics and populates the DMRANKINGITEM database table. GenerateRankingPolicyCmdImpl must implement the GenerateRankingPolicyCmd interface.

In this tutorial, the default ranking list policy is reused for the top viewed recipes' actions, where recipe is defined as a business object. When reusing the provided default ranking list policy commands, a new ObjectType identifier is defined for the new type of recipe list.

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

In this tutorial, the following ranking list policy is used:

<policy policy_ policyname="RecipeRankingPolicy" policytype_ storeent_ properties="ObjectType=2" />
<policycmd policy_ businesscmdclass="com.ibm.commerce.marketing.commands.ranking.CleanupRankingPolicyCmdImpl" />
<policycmd policy_ businesscmdclass="com.ibm.commerce.marketing.commands.ranking.GenerateRankingPolicyCmdImpl" />

Where policy_id is used when defining the campaign element template, and ObjectType ID is used when inserting entries into the statistics database table. In this tutorial, the policy ID is specified as- 9003 in the campaign element template implementation definition, the ObjectType ID is specified as 2 in the RecipeTopViewedCmdImpl command, and the new business policy is of type Ranking.


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 policy(POLICY_ID,POLICYNAME,POLICYTYPE_ID,STOREENT_ID,PROPERTIES) values (-9003,'RecipeRankingPolicy','Ranking',0,'ObjectType=2');
    insert into policycmd(POLICY_ID,BUSINESSCMDCLASS) values (-9003, 'com.ibm.commerce.marketing.commands.ranking.CleanupRankingPolicyCmdImpl');
    insert into policycmd(POLICY_ID,BUSINESSCMDCLASS) values (-9003, 'com.ibm.commerce.marketing.commands.ranking.GenerateRankingPolicyCmdImpl');
    


Related concepts

Rank list framework for marketing actions

< Previous | Next >


+

Search Tips   |   Advanced Search