Event API Responses

Requests sent to the Event API return JSON that contains information about any campaigns that are returned. A response from the Event API has the following structure.

KeyValueDescription
campaignResponsesCampaignResponse[]An array of all campaigns returned in the event. For more information, see The CampaignResponse Object.
compiledCampaignTemplatesCompiledCampaignTemplate[]An array of all campaign templates returned in the event. For more information, see The CompiledCampaignTemplates Object.
errorCodeNumberThe error code. Possible values are:
  • 0 : Success
  • 1 : Missing Encrypted UserId Parameter
  • 2 : Invalid Encrypted UserId Parameter
  • 3 : Busy
  • 4: Anonymous ID Correction
  • 5: Invalid Event
resolvedUserIdStringThe primaryId of the resolved User. The primaryId is only returned if the Pipeline Identity Resolution feature is enabled for the tenant. For more information, see User Identity Mapping.
persistedUserIdObjectAn object containing the encrypted user ID of the user. The Event API returns the persistedUserId only if Pipeline Identity Resolution isn’t enabled for the tenant and a primary user ID is specified in the event. For more information, see User Identity Mapping.
eventDetailseventDetailsAn object containing the event received by the server. This object is only returned if debug.explanations was sent with the event and the event was authenticated.

The CampaignResponse object contains data associated with the campaigns returned from an event.

KeyValueDescription
typeStringThe type of campaign returned. The value of type is "c" for server-side campaigns and "ng" for web campaigns.
campaignIdStringThe ID of the campaign returned.
campaignNameStringThe name of the campaign returned.
campaignTypeStringThe type of the campaign returned. The value of campaignType is "ServerSide" for server-side campaigns and "Web" for web campaigns.
experienceIdStringThe ID of the experience returned.
experienceNameStringThe name of the experience returned.
stateStringThe state of the campaign returned. The value of state can be "Published", "Disabled", or "Testing" depending on the campaign state.
displayModeStringDeprecated. This object is only returned for server-side campaigns and its value is always "Personalized".
redirectUrlNullDeprecated. This object is only returned for server-side campaigns.
saveParametersBooleanDeprecated. This object is only returned for server-side campaigns and is always set to false.
hidePageBeforeRedirectBooleanDeprecated. This object is only returned for server-side campaigns and is always set to false.
campaignJavascriptContentNullDeprecated. The campaignJavascriptContent object is always set to null.
javascriptContentNullDeprecated. This object is only returned for server-side campaigns and is always set to null.
userGroupStringThe user group of the campaign experience returned. The value of userGroup can be either "Default" or "Control".
googleAnalyticsConfigNullDeprecated. This object is only returned for server-side campaigns and is always set to null.
messagesEmpty arrayDeprecated. This object is only returned for server-side campaigns and is always set to [].
pageChangesEmpty arrayDeprecated. This object is only returned for server-side campaigns and is always set to [].
templateNamesString arrayAn array of the template names used in the experience. This object is only returned for web campaigns.
serverSideMessagesServerSideMessage[]An array of messages returned for a server-side campaign. This object is only returned for server-side campaigns. The event must be sent with source.channel set to "Server" in order to return serverSideMessages. For more information, see ServerSideMessage object.
payloadpayloadThe payload object that the campaign returns. The payload object always includes the campaign, experience, and userGroup fields, along with other user defined fields. For more information, see Template Server Typescript. Note: The value of campaignResponse.payload.userGroup can either be "Test" or "Control".

The ServerSideMessage object contains data associated with serverSideMessages returned in a campaignResponse.

For server-side campaigns, an array of ServerSideMessage objects is returned that contains information about the data returned for the server-side campaign message. The event must be sent with source.channel set to "Server" in order to return serverSideMessages. For more information on configuring server-side campaigns, see Server-Side Campaigns.

KeyValueDescription
typeStringThe type of message that is returned. For a ServerSideMessage, the type is always "evg_md".
idStringThe ID of the message that is returned.
dataStringDeprecated. Its value is always "{}".
targetNameStringThe name of the target for the ServerSideMessage.
containsDynamicContentBooleanThe value returned is true if the message contains any dynamic content, and false if the message doesn’t contain dynamic content.
promotedItemKeysPromotedItem[] | nullIf the message contains promoted items, promotedItemKeys is an array of promoted items. Otherwise its value is null. Each PromotedItem returned contains the type of the item returned and the _id of the item returned.
campaignState"Published", "Disabled", or "Testing"The state of the campaign returned.
dataMapdataMapAn object containing the key value pairs defined in the campaign.

The following is an example of a value returned in the promotedItemKeys object:

The following is an example of a value returned in the dataMap object:

For keys with type "Promoted Content", the full value of each item is returned unless the "Item IDs only" option is enabled in the message settings. For more information on configuring server-side campaigns and the returned dataMap object, see Server-Side Campaigns.

The CompiledCampaignTemplates object contains data associated with campaignTemplates returned in an event.

An event response returns an array of any compiledCampaignTemplates used in a campaignResponse. The compiledCampaignTemplates object contains information about the campaign templates.

KeyValueDescription
idStringThe ID of the template.
nameString or nullThe name of the template.
bundleStringThe stringified client-side code used to render the template.

The CampaignExplanations Object contains data associated with campaignExplanations returned in an event.

The campaignExplanations object returns in an event only if debug.explanations is true in the event payload. It contains additional information about why campaigns did or didn’t return in the event response. It’s only returned if the event request is authenticated.

KeyValueDescription
classStringInformation of the type of explanation that is returned.
campaignIdStringThe ID of the campaign that the explanation is for.
campaignNameStringThe name of the campaign that the explanation is for.
experienceIdStringThe ID of the experience that the explanation is for.
experienceNameStringThe name of the experience that the explanation is for.
messageIdStringThe ID of the message that the explanation is for.
explanationMessageStringA message containing the reason for not returning the campaign in the response.
contextStringA string containing the campaign name, campaign ID, experience name, and experience ID for the message that isn't returned in the response.