![]() |
sessionID:用于标识会话标识的字符串。
|
![]() |
eventName:用于标识事件名称的字符串。
|
![]() |
eventParameters:NameValuePairImpl 对象标识需要与事件一起传递的任何参数。这些值存储在会话数据中。
|
![]() |
如果此事件记录到响应历史记录,那么您必须为商品传递处理代码。 您必须将 NameValuePair 的名称定义为“UACIOfferTrackingCode”。
|
![]() |
还有其他一些保留参数用于 postEvent 和其他方法,本节中后面的部分将进行讨论。
|
String eventName = "SearchExecution";
NameValuePair parmB1 = new NameValuePairImpl();
parmB1.setName("SearchString");
parmB1.setValueAsString("mortgage");
parmB1.setValueDataType(NameValuePair.DATA_TYPE_STRING);
NameValuePair parmB2 = new NameValuePairImpl();
parmB2.setName("TimeStamp");
parmB2.setValueAsDate(new Date());
parmB2.setValueDataType(NameValuePair.DATA_TYPE_DATETIME);
NameValuePair parmB3 = new NameValuePairImpl();
parmB3.setName("Browser");
parmB3.setValueAsString("IE6");
parmB3.setValueDataType(NameValuePair.DATA_TYPE_STRING);
NameValuePair parmB4 = new NameValuePairImpl();
parmB4.setName("FlashEnabled");
parmB4.setValueAsNumeric(1.0);
parmB4.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair parmB5 = new NameValuePairImpl();
parmB5.setName("TxAcctValueChange");
parmB5.setValueAsNumeric(0.0);
parmB5.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair parmB6 = new NameValuePairImpl();
parmB6.setName("PageTopic");
parmB6.setValueAsString("");
parmB6.setValueDataType(NameValuePair.DATA_TYPE_STRING);
NameValuePair[] postEventParameters = { parmB1,
parmB2,
parmB3,
parmB4,
parmB5,
parmB6
};
/** Make the call */
response = api.postEvent(sessionId, eventName, postEventParameters);
/** Process the response appropriately */
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("postEvent call processed with no warnings or errors");
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("postEvent call processed with a warning");
}
else
{
System.out.println("postEvent call processed with an error");
}
// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("postEvent",
response.getAdvisoryMessages());
Copyright IBM Corporation 2014. All Rights Reserved.
|