Implementing MomentPerks SDK (Embedded Mode)
17 min
who is this for web developers who want to display momentperks offers inline within a page layout rather than in a modal overlay outcome integrate the momentperks javascript sdk in embedded mode using a target container element, rendering offers as a seamless part of the existing page 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 https //app momentscience com/account/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 to render offers inline in your page layout, update your sdk configuration to use embedded mode configure embedded settings add the following to your window\ adpxconfig object embedded settings window\ adpxconfig = { accountid 'your sdk id', autoshow true, settings { embedded { enabled true, targetelement 'adpx', showheader true, showfooter true, showborder true, fill container true } } }; embedded mode parameters parameter type default description enabled boolean false enables embedded mode so offers render inline instead of in a modal targetelement string adpx container element id where offers render must match the container you created in step 1 showheader boolean true shows the offer unit header showfooter boolean true shows the offer unit footer showborder boolean true adds a border around the embedded offer unit fill container boolean false expands the offer unit to fill the container height key checks ensure targetelement exactly matches the id of the \<div> created in step 1 if targetelement is missing, the sdk uses adpx by default confirm enabled true is set under settings embedded ; otherwise, the sdk keeps modal behavior for more information, please refer to the presentation options docid 9ukjgfqbk0fvd1qahw51l documentation 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 https //app momentscience com/ and navigate to the integrations section https //app momentscience com/account/integration/customize#customize 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 https //app momentscience com/account/settings/behavior/ 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\@momentscience com mailto\ help\@momentscience com