postEvent

The postEvent method enables you to execute any event defined in the interactive channel.

function callPostEvent(commandsToExecute, callback) {

        var ssId = document.getElementById('pe_sessionId').value;
        var ev = document.getElementById('event').value;
        var params = document.getElementById('parameters').value; 

        InteractAPI.postEvent(ssId, ev, getNameValuePairs(params), callback);

}
  • sessionID: a string identifying the session ID.

  • eventName: a string identifying the name of the event.

    Note: The name of the event must match the name of the event as defined in the interactive channel. This name is case-insensitive.
  • eventParameters. NameValuePairImpl objects identifying any parameters that need to be passed with the event. These values are stored in the session data.

    If this event triggers re-segmentation, you must ensure that all data required by the interactive flowcharts is available in the session data. If any of these values have not been populated by prior actions (for example, from startSession or setAudience, or loading the profile table) you must include an eventParameter for every missing value. For example, if you have configured all profile tables to load into memory, you must include a NameValuePair for temporal data required for the interactive flowcharts.

    If you are using more than one audience level, you most likely have different sets of eventParameters for each audience level. You should include some logic to ensure you are selecting the correct set of parameters for the audience level.

    Important: If this event logs to response history, you must pass the treatment code for the offer. You must define the name for the NameValuePair as "UACIOfferTrackingCode".

    You can only pass one treatment code per event. If you do not pass the treatment code for an offer contact, Unica Interact logs an offer contact for every offer in the last recommended list of offers. If you do not pass the treatment code for a response, Unica Interact returns an error.

  • callback - If the method was successful, the callback function calls onSuccess. If the method failed, the callback function calls onError.
  • There are several other reserved parameters used with postEvent and other methods and are discussed later in this section.

Any request for re-segmentation or writing to contact or response history does not wait for a response.

Re-segmentation does not clear prior segmentation results for the current audience level. You can use the UACIExecuteFlowchartByName parameter to define specific flowcharts to run. The getOffers method waits for re-segmentation to finish before running. Therefore, if you call a postEvent method, which triggers a re-segmentation immediately before a getOffers call, there might be a delay.

Return value

The runtime server responds to postEvent with a Response object with the following attributes populated:

  • AdvisoryMessages
  • ApiVersion
  • OfferList
  • Profile
  • SessionID
  • StatusCode