|
The area on the page displaying the upgrade offer must be defined. Also, once Interact picks an offer to display, the information must be logged.
|
NameValuePair evtParam_TreatmentCode = new NameValuePairImpl();
evtParam_TreatmentCode.setName("UACIOfferTrackingCode");
evtParam_TreatmentCode.setValueAsString(offer.getTreatmentCode());
evtParam_TreatmentCode.setValueDataType(NameValuePair.DATA_TYPE_STRING);
Response response=getOffers(sessionID, ip_planSummaryBottomRight, 1)
OfferList offerList=response.getOfferList();
if(offerList.getRecommendedOffers() != null)
{
Offer offer = offerList.getRecommendedOffers()[0];
NameValuePair[] attributes = offer.getAdditionalAttributes();
for(NameValuePair attribute: attributes)
{
if(attribute.getName().equalsIgnoreCase("offerImg"))
{
/* Use this value in your code for the page, for
example: stringHtml = "<img src="+attribute.getValueAsString()+ " > */
}
}
}
NameValuePair evtParam_TreatmentCode = new NameValuePairImpl();
evtParam_TreatmentCode.setName("UACIOfferTrackingCode");
evtParam_TreatmentCode.setValueAsString(offer.getTreatmentCode());
evtParam_TreatmentCode.setValueDataType(NameValuePair.DATA_TYPE_STRING);
postEvent(sessionID, evt_logOffer, evtParam_TreatmentCode)
Command getOffersCommand = new CommandImpl();
getOffersCommand.setMethodIdentifier(Command.COMMAND_GETOFFERS);
getOffersCommand.setInteractionPoint(ip_planSummaryBottomLeft);
getOffersCommand.setNumberRequested(1);
Command postEventCommand = new CommandImpl();
postEventCommand.setMethodIdentifier(Command.COMMAND_POSTEVENT);
postEventCommand.setEvent(evt_logOffer);
/** Build command array */
Command[] commands =
{
getOffersCommand,
postEventCommand
};
/** Make the call */
BatchResponse batchResponse = api.executeBatch(sessionId, commands);
Response response=getOffers(sessionID, ip_planSummaryBottomLeft, 3)
OfferList offerList=response.getOfferList();
if(offerList.getRecommendedOffers() != null)
{
for(int x=0;x<3;x++)
{
Offer offer = offerList.getRecommendedOffers()[x];
if(x==0)
{
// grab offerimg attribute value and store somewhere;
// this will be the first image to display
}
else if(x==1)
{
// grab offerimg attribute value and store somewhere;
// this will be the second image to display
}
else if(x==2)
{
// grab offerimg attribute value and store somewhere;
// this will be the third image to display
}
}
}
NameValuePair evtParam_TreatmentCodeSTR = new NameValuePairImpl();
NameValuePair evtParam_TreatmentCodeSBR = new NameValuePairImpl();
NameValuePair evtParam_TreatmentCodeSBL = new NameValuePairImpl();
OfferList offerList=response.getOfferList();
if(offerList.getRecommendedOffers() != null)
{
for(int x=0;x<3;x++)
{
Offer offer = offerList.getRecommendedOffers()[x];
if(x==0)
{
evtParam_TreatmentCodeSTR.setName("UACIOfferTrackingCode");
evtParam_TreatmentCodeSTR.setValueAsString(offer.getTreatmentCode());
evtParam_TreatmentCodeSTR.setValueDataType(NameValuePair.DATA_TYPE_STRING);
}
else if(x==1)
{
evtParam_TreatmentCodeSBR.setName("UACIOfferTrackingCode");
evtParam_TreatmentCodeSBR.setValueAsString(offer.getTreatmentCode());
evtParam_TreatmentCodeSBR.setValueDataType(NameValuePair.DATA_TYPE_STRING);
}
else if(x==2)
{
evtParam_TreatmentCodeSBL.setName("UACIOfferTrackingCode");
evtParam_TreatmentCodeSBL.setValueAsString(offer.getTreatmentCode());
evtParam_TreatmentCodeSBL.setValueDataType(NameValuePair.DATA_TYPE_STRING);
}
}
}
postEvent(sessionID, evt_offerAccept, evtParam_TreatmentCodeSTR)
postEvent(sessionID, evt_offerReject, evtParam_TreatmentCodeSBR)
postEvent(sessionID, evt_offerReject, evtParam_TreatmentCodeSBL)
Copyright IBM Corporation 2014. All Rights Reserved.
|