创建脚本

投放内容的选择将由脚本计算。 此脚本以最高打开率恢复有关投放的信息,并将内容复制到最终投放。

脚本的示例

以下脚本可以像在定位工作流程中一样使用。 有关详细信息,请参阅实施

 // query the database to find the winner (best open rate)
   var winner = xtk.queryDef.create(
     <queryDef schema="nms:delivery" operation="get">
       <select>
         <node expr="@id"/>
         <node expr="@label"/>
         <node expr="[@operation-id]"/>
         <node expr="[@workflow-id]"/>
       </select>
       <where>
         <condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
       </where>
       <orderBy>
         <node expr="[indicators/@estimatedRecipientOpenRatio]" sortDesc="true"/>
       </orderBy>
     </queryDef>).ExecuteQuery()
   
   // create a new delivery object and initialize it by doing a copy of
   // the winner delivery
   var delivery = nms.delivery.create()
   delivery.Duplicate("nms:delivery|" + winner.@id)

   // append 'final' to the delivery label
   delivery.label = winner.@label + " final"

   // link the delivery to the operation to make sure it will be displayed in
   // the campaign dashboard. This attribute needs to be set manually here since 
   // the Duplicate() method has reset it to its default value => 0
   delivery.operation_id = winner.@["operation-id"]
   delivery.workflow_id = winner.@["workflow-id"]

   // adjust some delivery parameters to make it compatible with the 
   // "Prepare and start" option selected in the Delivery tab of this activity
   delivery.scheduling.validationMode = "manual"
   delivery.scheduling.delayed = 0
 
   // save the delivery in database
   delivery.save()
 
   // store the new delivery Id in event variables
   vars.deliveryId = delivery.id

有关脚本的详细说明,请参阅脚本的详细信息

实现

  1. 打开​JavaScript code​活动。

  2. 脚本示例中提供的脚本复制到​JavaScript code​窗口中。

  3. 在​Label​字段中,输入脚本的名称,即

    <%= vars.deliveryId %>
    

  4. 关闭​JavaScript code​活动。

  5. 保存您的工作流。

脚本的详细信息

本部分详细介绍了脚本的各个部分及其操作模式。

  • 脚本的第一部分是查询。 使用​queryDef​命令,您可以从​NmsDelivery​表中恢复通过执行定位工作流创建的投放,并根据其估计的打开率对它们进行排序,然后恢复来自打开率最高的投放的信息。

    // query the database to find the winner (best open rate)
       var winner = xtk.queryDef.create(
         <queryDef schema="nms:delivery" operation="get">
           <select>
             <node expr="@id"/>
             <node expr="@label"/>
             <node expr="[@operation-id]"/>
           </select>
           <where>
             <condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
           </where>
           <orderBy>
             <node expr="[indicators/@estimatedRecipientOpenRatio]" sortDesc="true"/>
           </orderBy>
         </queryDef>).ExecuteQuery()
    
  • 打开率最高的投放是重复的。

     // create a new delivery object and initialize it by doing a copy of
     // the winner delivery
    var delivery = nms.delivery.create()
    delivery.Duplicate("nms:delivery|" + winner.@id)
    
  • 将修改复制投放的标签,并将单词​final​添加到该标签中。

    // append 'final' to the delivery label
    delivery.label = winner.@label + " final"
    
  • 投放将复制到活动仪表板。

    // link the delivery to the operation to make sure it will be displayed in
    // the campaign dashboard. This attribute needs to be set manually here since 
    // the Duplicate() method has reset it to its default value => 0
    delivery.operation_id = winner.@["operation-id"]
    delivery.workflow_id = winner.@["workflow-id"]
    
    // adjust some delivery parameters to make it compatible with the 
    // "Prepare and start" option selected in the Delivery tab of this activity
    delivery.scheduling.validationMode = "manual"
    delivery.scheduling.delayed = 0
    
  • 投放保存在数据库中。

    // save the delivery in database
    delivery.save()
    
  • 复制投放的唯一标识符存储在工作流变量中。

    // store the new delivery Id in event variables
    vars.deliveryId = delivery.id
    

其他选择标准

通过上面的示例,您可以根据电子邮件的打开率选择投放的内容。 您可以根据其他特定投放的指标调整它:

  • 最佳点击吞吐量:[indicators/@recipientClickRatio],
  • 最高反应率(打开电子邮件并在邮件中单击):[indicators/@reactivity],
  • 最低投诉率:[indicators/@refusedRatio](对sortDesc属性使用false值),
  • 最高转化率:[indicators/@transactionRatio],
  • 接收消息后访问的页数:[indicators/@totalWebPage],
  • 最低退订率:[indicators/@optOutRatio],
  • 事务处理金额:[indicators/@amount]

您现在可以定义最终投放(请参阅步骤6:定义最终投放)。

On this page

Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now