Analyzing E-Spot Trace

After pulling the thread for request, examine the low level of Marketing trace to understand the marketing logic evaluation for web activity to display target-specific content in e-spot.

The following web activity is expected to display the targeted content for the computer accessories page and the default content in E-Marketing Spot for other categories.

If you know the name of the e-spot, search for GetMarketingSpotDataCmdImpl foundMatchForMarketingSpot EVALUATION-TRACE to determine the start and end of the evaluation trace for a problematic e-spot.
  • In the following example, the e-spot name is MyE-MarketingSpot.
    00000122 GetMarketingS 1 com.ibm.commerce.marketing.facade.server.commands.GetMarketingSpotDataCmdImpl foundMatchForMarketingSpot EVALUATION-TRACE: begin evaluation of e-Marketing Spot:MyE-MarketingSpot
    00000122 GetMarketingS 1 com.ibm.commerce.marketing.facade.server.commands.GetMarketingSpotDataCmdImpl foundMatchForMarketingSpot EVALUATION-TRACE: end   evaluation of e-Marketing Spot:MyE-MarketingSpot
    
    Note: Time stamp, threadId, and package name are removed from the following examples to simplify the test trace snippet.
  • Above trace entries mark the starting and ending point of the e-spot. After identifying the points, find all of the marketing web activities configured for this e-spot by searching MarketingEngineCache getEMarketingSpotActivities keyword. Following output is displayed.
    MarketingEngineCache getEMarketingSpotActivities ENTRY 11501 10,201
    MarketingEngineCache getEMarketingSpotActivities need to sort as results are from more than one store
    MarketingEngineCache getEMarketingSpotActivities RETURN [name= DisplayEms storeId= 10201 activityId= 10801 elementId= 11402 allusers= 1 emsId=11501, name= DisplayEms storeId= 10201 activityId= 10802 elementId= 11406 allusers= 1 emsId=11501]
    
  • From the above output, two activities are returned for this e-spot. Verify if the expected activity (activityId=10801) is evaluated correctly.
  • The marketing engine validates the activity schedule, repeatable flag and returns valid activities.
    TriggerHandler shouldAddActivity ENTRY
    TriggerHandler shouldAddActivity allUsers= true
    TriggerHandler shouldAddActivity 
  • Activity has triggers for all users. Do not check user behavior as the user can get the following trigger.
    • TriggerHandler shouldAddActivity repeatableActivity= true
      TriggerHandler shouldAddActivity RETURN
      
    • TriggerHandler isDateValidForActivity ENTRY
      TriggerHandler isDateValidForActivity activityStart=null  activityEnd=null
      TriggerHandler isDateValidForActivity Activity in progress - date is valid!
      TriggerHandler isDateValidForActivity RETURN
      
  • In this case, both activities are validated and repeatable. To find all the valid activities returned by the marketing engine, search for TriggerHandler findListeningActivity Listening activities [activity,trigger]= [[10802,11406][10801,11402]].
  • If the marketing engine does not find any activities scheduled for the e-spot, the following result is displayed:
    TriggerHandler findListeningActivity Listening activities [activity,trigger]= []
    TriggerHandler findListeningActivity RETURN
    TriggerHandler raiseEMSTrigger triggerListenerList.length=0
    TriggerHandler raiseEMSTrigger return bean is null
  • In the above snippet, the activities 10802 and 10801 are scheduled for emsId=11501. Evaluate the 10801 and 10802 activities.
  • Search TriggerHandler raiseEMSTrigger EVALUATION-TRACE to see the web activity evaluation.
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: begin evaluation of all activities
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: begin evaluation of activity: 10802: RecommendContentForMen's
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: end   evaluation of activity: 10802
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: begin evaluation of activity: 10801: MyCDPActivity
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: end   evaluation of activity: 10801
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: end   evaluation of all activities
    
  • After finding the web activities, the marketing engine evaluates the activity flow, trigger, target, and action in order the elements are defined in the activity. Search for MarketingEngineCache getActivity activity flow to get the flow.
    MarketingEngineCache getActivity Activity flow: <Flow> <FlowElement type=Trigger id=11406 ></FlowElement> <FlowElement type=Target id=11408 ></FlowElement> <FlowElement type=Action id=11407 repeat=true ></FlowElement> </Flow>
  • Each Trigger, Target, and Action has a task command that implements the corresponding element. For example, if the next element in the Web Activity is Target: Current Page.
  • The command CustomerFilterUserBehaviorTargetTaskCmdImpl is used to evaluate the target. For example,
    CustomerFilterUserBehaviorTargetTaskCmdImpl performExecute ENTRY
    CustomerFilterUserBehaviorTargetTaskCmdImpl performExecute elementId: 11408
    CustomerFilterUserBehaviorTargetTaskCmdImpl performExecute result: true/false
    CustomerFilterUserBehaviorTargetTaskCmdImpl performExecute RETURN
    
  • To determine the command to evaluate the next element in the web activity for troubleshooting, see List of shipped campaign element templates and task commands for more information.
  • If one of the targets in the web activity is evaluated to be true, proceed to the next web activity element. The following line of code is displayed:
    MarketingEngine processElement qualify is true, continue along this path, increase counter
    MarketingEngine processElement Set that we are committed to this path
    
  • No content is displayed if one of the web activity's targets is evaluated as false. The following line of code is displayed:
    MarketingEngine processElement qualify is false, do not continue along this path
Note: From the evaluation of two activities returned earlier, one of the activities will meet the target condition and display the action item, whereas the other one with fail on target evaluation and stop processing further.

Non-working case

activity: 10802: RecommendContentForMen's
TriggerHandler raiseEMSTrigger EVALUATION-TRACE: begin evaluation of activity: 10802: RecommendContentForMen's
 MarketingEngine processTrigger child node : Trigger
     MarketingEngine processElement ENTRY Trigger
     MarketingEngine processElement trigger id : 11406
     MarketingEngine processElement match trigger id : 11406
     MarketingEngine processElement matched with the match trigger id : 11406 so now process the flow, set foundTriggerId=true and increase counter
     MarketingEngine processElement Set that we are committed to this path
     MarketingEngine processElement returnValues for Trigger= foundTriggerId=true stopProcessingPath=false committedToPath=true...
     MarketingEngine processElement RETURN Trigger
 MarketingEngine processTrigger child node : Target
     MarketingEngine processElement ENTRY Target
     MarketingEngine processElement targetId : 11408
     MarketingEngine processElement qualify is false, do not continue along this path
     MarketingEngine processElement returnValues for Target= foundTriggerId=true stopProcessingPath=true committedToPath=true...
     MarketingEngine processElement RETURN Target
     MarketingEngine processTrigger target or trigger said stop, so do not continue the flow
     MarketingEngine processTrigger Do not need to save the user behavior information
     MarketingEngine processTrigger RETURN
TriggerHandler raiseEMSTrigger EVALUATION-TRACE: end   evaluation of activity: 10802
Note: As the non-working case target did not qualify, the marketing engine stopped processing the activity.

Working case

activity: 10801: MyCDPActivity
TriggerHandler raiseEMSTrigger EVALUATION-TRACE: begin evaluation of activity: 10801: MyCDPActivity
 MarketingEngine processTrigger child node : Trigger
     MarketingEngine processElement ENTRY Trigger
     MarketingEngine processElement trigger id : 11402
     MarketingEngine processElement match trigger id : 11402
     MarketingEngine processElement matched with the match trigger id : 11402 
  • Process the flow and set foundTriggerId=true.
  • Increase counter MarketingEngine and processElement.
  • Set that you are committed to this path.
    MarketingEngine processElement returnValues for Trigger= foundTriggerId=true stopProcessingPath=false committedToPath=true...
         MarketingEngine processElement RETURN Trigger
     MarketingEngine processTrigger child node : Target
         MarketingEngine processElement ENTRY Target
         MarketingEngine processElement targetId : 11404
         MarketingEngine processElement qualify is true,
  • Continue along this path and increase counter
    MarketingEngine processElement returnValues for Target= foundTriggerId=true stopProcessingPath=false committedToPath=true...
         MarketingEngine processElement RETURN Target
     MarketingEngine processTrigger child node : Action
         MarketingEngine processElement ENTRY Action
         MarketingEngine processElement match trigger id : 11402
         MarketingEngine processElement actionId : 11403
         MarketingEngine processElement action's relatedId : null
         MarketingEngine processElement relatedId = null
         MarketingEngine processElement actionId : 11403 and increase counter
         MarketingEngine processElement repeatableAction= true
         MarketingEngine processElement actionAlreadyPerformed= false
         MarketingEngine processElement experiment data:[]
         MarketingEngine processElement continuePastAction is true, continue along this path, increase counter
         MarketingEngine processElement Set that we are committed to this path
         MarketingEngine processElement returnValues for Action= foundTriggerId=true stopProcessingPath=false committedToPath=true...
         MarketingEngine processElement RETURN Action
    
  • As part of the action, DisplayMarketingContentActionTaskCmdImpl is called to retrieve marketing content to be displayed:
     DisplayMarketingContentActionTaskCmdImpl performExecute ENTRY
     DisplayMarketingContentActionTaskCmdImpl performExecute activityId= 10801
     DisplayMarketingContentActionTaskCmdImpl performExecute collateralIdList= 10207
     DisplayMarketingContentActionTaskCmdImpl performExecute expected end of the string
     DisplayMarketingContentActionTaskCmdImpl performExecute RETURN
    TriggerHandler raiseEMSTrigger EVALUATION-TRACE: end   evaluation of activity: 10801
    
  • The execution is completed successfully in the trace where activity 10801 is evaluated successfully, and activity 10802 did not meet the target condition. If you end up with multiple activities meeting all the target criteria, then you see multiple contents being returned. See Web activities for more details on sequence and priority.
Once all activities are evaluated successfully, see the result traced out as follows:
TriggerHandler raiseEMSTrigger EVALUATION-TRACE: end   evaluation of all activities
TriggerHandler raiseEMSTrigger EVALUATION-TRACE: recommendation from activity:
TriggerHandler raiseEMSTrigger    type= MarketingContent
TriggerHandler raiseEMSTrigger    data= 10207
TriggerHandler raiseEMSTrigger    activity id= 10801
TriggerHandler raiseEMSTrigger RETURN 
Note: MarketingContent with collateralId 10207 is displayed in the e-spot. Verify the content returned by marketing e-spot evaluation with BOD or REST response.