Interaction Event Options in the SalesforceInteractions Namespace

The following code sample details the event options available in the SalesforceInteractions namespace in the Personalization module of the Salesforce Interactions SDK.

The interaction object has the following structure.

You can use the Interaction field to capture user engagement data. The Interaction field has the following structure.

This type of Interaction is used to capture engagement data about catalog objects.

You can use the location object to send location data on a catalogObject via the Event API or using the Sitemap. The following is an example of how to structure a catalogObject to include location data.

The following examples depict sending data for locations outside the US.

This type of Interaction is used to capture engagement data about the contents of a user's cart.

This type of Interaction is used to capture engagement data about the items in a user's order. Only the PurchaseOrderInteraction affects and updates a user's current order.

A LineItem represents a single item in a cart and/or transaction. A LineItem object has the following structure.

The following table describes the properties that a LineItem object accepts.

PropertyValue TypeDescription
catalogObjectTypeStringThe type representing the catalog object.
catalogObjectIdStringA unique ID representing the catalog object.
quantityNumberThe number of catalog objects in the line item.
priceNumberThe price of the catalog object in the line item. Important: price is mandatory only when using LineItem in a purchase or cart interaction, and optional for other interactions.
currencyStringOptional. Currency code of purchase. If currency is unspecified or null, it defaults to the dataset's configured currency.
attributes{[key: string]: string | number | boolean }Optional. Key-value pairs that are stored as metadata on the LineItem. You can include sku within attributes.

The following is an example of a line item used within an AddToCart interaction.

The consent field accepts an array of consent objects for the user. The following table describes the various properties available in the consent object.

PropertyValue TypeDescription
purposeStringThe purpose for the consent. For example, Personalization.
providerStringThe consent provider
statusStringThe consent status. For example, OptIn or OptOut

The debug object contains fields that help investigate issues that could arise when developing campaigns.

The following table describes the properties available in the debug object.

PropertyValue TypeDescription
testMessagesStringA comma-separated list of campaign experience IDs to be forced to return in the event, ignoring rules that would otherwise prevent the campaign from returning. Alternatively, you can use the string value true to return all campaigns in testing mode but all rules are respected.

The flags object contains properties that alter default event processing. By default, all flags are false if not present on the event.

The following table describes the various properties available in the flags object.

PropertyValue TypeDescription
noCampaignsBooleanIf true, don’t return campaigns in the response.
nonInteractiveBooleanIf true, a visit isn’t created (or updated) for the given user in the event. Additionally, no visit referrer nor originating referrer is created for the user.

The Source object contains properties that help describe where an event is coming from. This object has the following structure.

The following table describes the various properties available in the Source object.

PropertyValue TypeDescription
channelStringThe originating source of the event (For example, Web, MobileApp, CallCenter).
applicationStringThe originating application level source of the event (For example, ReactApp, 3rdParty, ReactNative)
pageTypeStringThe type of page from which you’re sending the event (For example, PDP, Blog, Pricing).
urlStringThe URL of the page from which you’re sending the event.
urlReferrerStringThe previous URL visited by the user. urlReferrer is populated from document.referrer by default on the web. It can be overwritten in the sitemap to any other value if necessary.
localeStringThe locale of the current page, as defined by ISO 639 alpha-2 language codes and ISO 3166 alpha-2 country codes (For example, en_US, de_DE).
contentZonesstring[]An array of content zones on the current page.
configVersionNumberVersion number of the configuration for the SDK.
userAgentStringThe user agent for the event. userAgent is populated automatically but can be overwritten if necessary
clientIpStringThe IP Address sending the event. clientIp is populated automatically but can be overwritten if necessary
operatingSystemStringOnly applicable for mobile events.
operatingSystemVersionStringOnly applicable for mobile events.
deviceStringOnly applicable for mobile events.
surveyIdStringThe ID of the survey being submitted. Set automatically for events sent through the Survey Gear
surveyStartTimeStringThe start time of the survey being submitted. Set automatically for events sent through the Survey Gear

The User object describes the user associated with an event.

The following table describes the various properties available in the user object.

PropertyValue TypeDescription
anonymousIdStringThe ID of an anonymous user.
identities[key: string]: stringKey-value pairs that are stored as identity information of a user.
encryptedIdStringThe encrypted ID returned from an event that contains the ID field. Encrypted IDs are returned in the response to events that provide identities.
attributes{ [key: string]: string | number | boolean }Key-value pairs that are stored as metadata on the user. These attributes must be defined in the platform.
profileObjects{ [profileObjectType: string]: ProfileObject[] }Key-value pairs of profile objects that are stored as metadata on the user. Profile objects, their attributes, and related catalog objects must be defined in the platform.

You can use the profileObjects field to send new or update existing profile objects via the Event API or using the Web SDK. You can send multiple profile objects of one type or multiple types in a single event.

To enable Strict Profile Object Security, log on to the Personalization UI and navigate to Settings > Catalog and Profile Objects > User Profile Object Settings. Enabling this setting restricts profile object updates to authenticated event sources such as ETL and Event API calls that use channel: Server and the /authevent endpoint. After it’s enabled, updates to profile objects from unauthenticated channels such as Web are ignored.

  • If an event causes a user to exceed 100 profile objects of a specific type, the 100 most recent objects are retained based on their creation date.
  • You can’t selectively update the fields of a profile object. You can only replace each instance of a profile object entirely. If you're updating an existing profile object, fields in the incoming event entirely replace the user's existing profile object fields.
  • A set of profile objects of a given type can’t be entirely replaced by another set or an empty set. For example, an event with profileObjects: { Lease: [] } doesn't clear out all Leases on that given user.
  • You can only create new or replace existing profile objects with Event API calls and not remove them.

The following table describes the properties that a ProfileObject accepts.

PropertyValue TypeDescription
idStringThe ID of a Profile Object.
relatedCatalogObjects{ [catalogObjectType: string]: string[] }Related catalog objects key-value pairs. These related catalog objects must be defined in the platform.
attributes{ [key: string]: string | number | boolean }Attribute key-value pairs that are stored as metadata on the profile object record. These attributes must be defined in the platform.

The following example depicts sending a single “Lease” profile object record with attributes and related catalog objects.

The Account object describes the account associated with an event.

The following table describes the various properties available in the account object.

PropertyValue TypeDescription
idStringThe ID of an account.
attributes{ [key: string]: string | number | boolean }Key-value pairs that are stored as metadata on the account. These attributes must be defined in the platform.

The PerformanceMetrics object has properties that measure loading, parsing, and network performance.

The following table describes the various properties available in the PerformanceMetrics object.

PropertyValue TypeDescription
sdkLoadTimeMsNumber(Web SDK) Time, in milliseconds, for the network to load the web SDK.
sdkParseTimeMsNumber(Web SDK) Time, in milliseconds, for the beacon to be parsed during page load.
pageLoadTimeMsNumber(Web SDK) Time, in milliseconds, for the DOM to load.
networkTimeMsNumber(Web SDK) Time, in milliseconds, for the previous request to return.

You can use the campaignStats object to track campaign statistics for an associated event.

For more information on sending campaign statistics on the web, refer to the Campaign Stats Tracking documentation.

The campaignStats object has the following structure.

The CampaignStat object has the following structure.

The following table describes the properties a CampaignStat object accepts.

PropertyValue TypeDescription
experienceIdStringThe experience ID of the campaign on which the given statistic is being tracked
stat"Impression" | "Click" | "Dismissal"The type of statistic being tracked.
controlBooleanIf true, the statistic is tracked for the control group of the given experience.
catalog{ <ItemType>: string[] }A mapping of catalog item types to a list of corresponding item IDs on which to attribute the given statistic.

The following is an example of a mapping of catalog item types.