Solutions
...
JavaScript SDK Guide
Implementing MomentPerks SDK (Embedded Mode)
18 min
overview the momentperks javascript sdk enables you to display personalized offers directly within your webpage or mobile webview this guide explains how to integrate the sdk in embedded mode, configure its behavior, customize its appearance, and verify the integration when to use embedded mode by default, the momentperks sdk displays offers in a modal overlay use embedded mode when you want to render offers inline as part of your page or app layout maintain a native experience without interrupting user flow control where the offer unit appears using a target container implementation steps follow these steps to implement the momentperks sdk as an embedded offer unit on your web page or within a mobile app webview step 1 identify/create the container element determine where you want the offer unit to be displayed on your page create a \<div> element that will serve as the container for the offer unit example html step 2 add the momentperks sdk script obtain the sdk code log in to the momentscience dashboard and navigate to the moments integration to obtain the momentperks sdk code snippet insert the sdk code into your web page paste the obtained sdk code into the \<head> section of your web page to ensure it loads correctly step 3 enable embedded mode 1 configure the sdk for embedded mode modify the sdk initialization code to specify that it should operate in embedded mode step 4 customize the interface and behavior you can customize the appearance and behavior of the offer unit either via the dashboard no code customization via code overrides use the settings and styles fields in the sdk configuration option a dashboard customization log in to the momentscience dashboard and navigate to the integrations section use the dashboard settings to customize the look and feel of the offer unit to match your siteβs design guidelines step 5 change the number of ads and other properties in the momentscience dashboard, go to the configuration section adjust the " number of ads" to control the number of offers to present at a time as needed without changing the code step 6 pass payload values for targeting, reporting, and personalization (optional) enhancing or optimizing your implementation of momentscience can be achieved by passing payload information when the momentscience unit is loaded this additional data allows the platform to target offers more effectively using payload values helps momentscience deliver more relevant offers to users, increasing the chances of conversion and overall yield improve reporting payload values can be utilized to segment and analyze performance across different dimensions, providing deeper insights into how various user groups interact with your offers personalize the moments experience by passing specific information about users, you can tailor the content and presentation of offers to better meet individual preferences and behaviors further recommendations to maximize the effectiveness and efficiency of your momentscience moments js sdk implementation, consider the following best practices and advanced techniques use macros to personalize your moments macros can be used to dynamically insert user specific data into your offers, enhancing personalization and relevance common macros include user names, order references, and purchase amounts utilize callback functions the moments js sdk supports callback functions that can be triggered at various points in the offer lifecycle this allows for greater control over user interactions and can be used to integrate with your internal tracking systems implement postbacks postbacks provide real time data on conversions related to your offers they are essential for tracking the effectiveness of your campaigns and optimizing them for better performance if you're running into any issues while going through the integration process, feel free to contact us at help\@m omentscience com