其他响应类型
Interact 中,您可以在 Interact API 中使用 postEvent 方法来触发用于记录对于商品的“接受”或“拒绝”操作的事件。您还可以扩充系统以使 postEvent 调用能够记录其他响应类型,如探查、考虑、提交或履行。所有这些响应类型都必须存在于 Campaign 系统表的 UA_UsrResponseType 表中。通过对 postEvent 方法使用特定事件参数,您可以记录其他响应类型并定义是否应在学习中包含接受。
要记录其他响应类型,必须添加以下事件参数:
*
UACIResponseTypeCode - 表示响应类型代码的字符串。该值必须是 UA_UsrResponseType 表中的有效条目。
要使条目在 UA_UsrResponseType 中有效,您必须定义表中的所有列,包括 CountsAsResponseCountsAsResponse 的有效值为 0、1 或 2。0 表示无响应,1表示有某个响应,2 表示拒绝。这些响应用于进行报告。
*
UACILogToLearning - 值为 1 或 0 的数字。1 指示 Interact 应将事件记录为接受学习。0 指示 Interact 不应记录学习事件。此参数使您可以创建若干 postEvent 方法,这些方法记录不同响应类型,而不影响学习。如果不定义 UACILogToLearning,那么 Interact 假定缺省值为 0。
您可能希望创建若干包含“记录商品接受”操作的事件,一个事件对应于您要记录的每个响应类型;或者要创建单个事件,其中包含您用于每个 postEvent 调用(用于记录单独响应类型)的“记录商品接受”操作。
例如,为每种类型的响应创建一个包含“记录商品接受”操作的事件。您将在 UA_UsrResponseType 表定义以下定制响应,形式为 [名称 (代码)]:探查 (EXP)、考虑 (CON)、提交 (CMT)。然后,您将创建三个事件并将其命名为 LogAccept_Explore、LogAccept_Consider 和 LogAccept_Commit。 所有这个三个事件都完全相同(具有“记录商品接受”操作),但是名称不同,以便使用 API 的人员能够区分它们。
或者,您也可以创建单个事件,其中包含您将用于所有定制响应类型的“记录商品接受”操作。例如,将其命名为 LogCustomResponse。
使用 API 时,事件之间没有功能上的差异,但是命名约定可能会使代码更加明确。 此外,如果您为每个定制响应提供一个单独名称,那么“渠道事件活动摘要”报告将显示更加精确的信息。
首先,设置所有名称/值对
//Define name value pairs for the UACIResponseTypeCode 
// Response type Explore
NameValuePair responseTypeEXP = new NameValuePairImpl();
responseTypeEXP.setName("UACIResponseTypeCode");
responseTypeEXP.setValueAsString("EXP");
responseTypeEXP.setValueDataType(NameValuePair.DATA_TYPE_STRING);

// Response type Consider
NameValuePair responseTypeCON = new NameValuePairImpl();
responseTypeCON.setName("UACIResponseTypeCode");
responseTypeCON.setValueAsString("CON");
responseTypeCON.setValueDataType(NameValuePair.DATA_TYPE_STRING);

// Response type Commit
NameValuePair responseTypeCMT = new NameValuePairImpl();
responseTypeCMT.setName("UACIResponseTypeCode");
responseTypeCMT.setValueAsString("CMT");
responseTypeCMT.setValueDataType(NameValuePair.DATA_TYPE_STRING);

//Define name value pairs for UACILOGTOLEARNING
//Does not log to learning
NameValuePair noLogToLearning = new NameValuePairImpl();
noLogToLearning.setName("UACILOGTOLEARNING");
noLogToLearning.setValueAsString("0");
noLogToLearning.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);

//Logs to learning
NameValuePair LogToLearning = new NameValuePairImpl();
LogToLearning.setName("UACILogToLearning");
LogToLearning.setValueAsString("1");
LogToLearning.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
以下第一个示例表明使用个别事件。
//EXAMPLE 1: This set of postEvent calls use the individually named events 
//PostEvent with an Explore response
NameValuePair[] postEventParameters = { responseTypeEXP, noLogToLearning };
response = api.postEvent(sessionId, LogAccept_Explore, postEventParameters);

//PostEvent with a Consider response
NameValuePair[] postEventParameters = { responseTypeCON, noLogToLearning };
response = api.postEvent(sessionId, LogAccept_Consider, postEventParameters);

//PostEvent with a Commit response
NameValuePair[] postEventParameters = { responseTypeCOM, LogToLearning };
response = api.postEvent(sessionId, LogAccept_Commit, postEventParameters);
以下第二个示例表明仅使用一个事件。
//EXAMPLE 2: This set of postEvent calls use the single event 
//PostEvent with an Explore response
NameValuePair[] postEventParameters = { responseTypeEXP, noLogToLearning };
response = api.postEvent(sessionId, LogCustomResponse, postEventParameters);

//PostEvent with a Consider response
NameValuePair[] postEventParameters = { responseTypeCON, noLogToLearning };
response = api.postEvent(sessionId, LogCustomResponse, postEventParameters);

//PostEvent with a Commit response
NameValuePair[] postEventParameters = { responseTypeCOM, LogToLearning };
response = api.postEvent(sessionId, LogCustomResponse, postEventParameters);
这两个示例执行完全相同的操作,但是,其中一个版本可能比另一个更容易阅读。