Event Code Samples

React Native Event Code Samples

The following events are available to use in the React Native version of the Monetate SDK.

Metadata Event

Imports LanguageData from @personalization-js-sdk/common.

metadata Event Code


Code Example

ContextMetadata Event Code Example


Screen Size Event

Imports ScreenSizeData from @personalization-js-sdk/common.

ScreenSize Event Code


Code Example

ContextScreenSize Event Code Example


User Agent Event

Imports UserAgentData from @personalization-js-sdk/common.

userAgent Event Code


Code Example

ContextUserAgent Event Code Example


Coordinates Event

Reports the coordinates of the customer.

Coordinates Event Code


Code Example

ContextCoordinates Event Code Example


Referrer Event

Reports the referrer.

referrer Event Code


Code Example

ContextReferrer Event Code Example


Context Variable Event

Imports ContextVariablesData from @personalization-js-sdk/common, and reports custom variables.

customVariables Event Code


Code Example

ContextCustomVariables Event Code Example


Page Event

Reports any events on the page.

pageEvents Event Code


Code Example

RecordPageEvents Event Code Example


Page View Event

Reports when a customer views a specified page.

PageView Event Code


Code Example

ContextPageView Event Code Example


Product Thumbnail Event

Reports when a customer views a product thumbnail.

ProductThumbnailView Event Code


Code Example

ContextProductThumbnailView Event Code Example


Product Detail View Event

Reports when a customer views a product detail page.

ProductDetailView Event Code


Code Example

ContextProductDetailView Event Code Example


Recommendation Clicks Event

Reports recommendations click events.

recClicks Event Code


Code Example

RecordRecClicks Event Code Example


Recommendation Impressions Event

Reports recommendations impression events.

recImpressions Event Code


Code Example

RecordRecImpressions Event Code Example


Impressions Event

Reports impression events.

impressions Event Code


Code Example

RecordImpressions Event Code Example


Add to Cart Event

Reports when a customer adds a product to their cart. Import and use the CartLinesData interface for this event. CartLine is the data structure used by this interface.

cartLines Event Code


Code Example

ContextCart Event Code Example


Purchase Event

Reports when a customer purchases products. Import and use the PurchaseData interface for this event. PurchaseLine is the data structure used by this interface.

purchaseLines Event Code


Code Example

ContextPurchase Event Code Example


Closed Session Event

Imports ClosedSessionData from @personalization-js-sdk/common.

closedSession Event Code


Code Example

ContextClosedSession Event Code Example


Decision Event

This event doesn't need to be created. The SDK automatically creates a decision event when you use the getActions method and pass a requestID as a string.