Moments

JS SDK (for Websites)

AdsPostX is now MomentScience! 🎉

We have rebranded AdsPostX to MomentScience. All the latest documentation and updates can now be found at MomentScience Documentation.

Introduction

Integrating AdsPostX into your online store, website, mobile app, or other user experience is designed to be easy and quick. This guide will provide you with the needed steps to integrate our JavaScript SDK.

Requirements

Before starting the integration process with the JS SDK, ensure you have the following:

  1. An AdsPostX account. If you don't have one yet, sign up now.
  2. An "SDK ID" (also known as "accountId"). You can obtain it by following these steps.

Steps Overview

The following playable demo will guide you through the steps required to integrate the AdsPostX JavaScript SDK with a website.


  1. Access the Integration Code: Navigate to the Moments Integration section and click "JS SDK", Here you can configure, view, download, and preview the JavaScript SDK, Just copy the code provided to you.
  2. Integrate the Code Into Your Website: Paste the integration code provided by the AdsPostX dashboard from the previous step before closing the </head>tag on your website.

Before proceeding, ensure that the value in accountIdin your integration code matches the one provided to you. This ensures proper association with your AdsPostX account.

Integration Code Example


Initialization Parameters

The initfunction supports the following attributes:

Name

Type

Description

accountId

String required

Your unique account ID, use your SDK ID. Learn how to retrieve it from here. 

autoLoad

Boolean optional

Default: true. Determines whether the AdsPostX SDK automatically fetches available Offers when it's ready.

  • When set to false, you need to manually call the AdsPostX SDK's refreshfunction to fetch and display Offers.

Learn more about Delaying the Moments Unit

autoShow

Boolean optional

Default: true. Determines whether the Offers overlay is automatically displayed when the AdsPostX SDK is ready.

  • When set to false, the AdsPostX SDK's showfunction must be called to trigger the Offers overlay.
  • If autoLoadis set to false,autoShowdoes not have any effect.

Learn more about Showing the Moments Unit

dev

Boolean optional

Default: false. Enables testing mode. Will return Offers for testing purposes but no activity will be recorded. In this mode, geo-targeting is ignored for publishers, ensuring that all Offers are returned in Offer responses for comprehensive testing

settings

Object optional

It can be used to override some Dashboard settings and to configure the presentation of the Moments Unit. Learn more about Override Settings

styles

Object optional

It can be used to apply custom styling at runtime. Learn more about Overide Styles

Initialization (init) configuration options must be specified within the properties of the window.AdpxConfig object.

Setting init Attributes



Want to embed the Web SDK into your website? Check out our guide here to learn how.

Passing In Payload Values

With AdsPostX, you can easily pass payload values through the JavaScript SDK. Whether you're working on the server side or client side, you have full control over the payload. Additionally, you can customize your payload by including your own key-value pairs.

Passing in payload values can enable the following:

  • Offer Personalization: You can use passed payload values to personalize our Offer messaging to making their experience more personal.
  • Enhanced Targeting: With payload values, you can target Offers more effectively, ensuring that the right content reaches the right audience.
  • Customized Reporting: You can pass payload values to attribute your implementations to generate reports to segregate performance and give you deeper insights into your business performance.
  • Supporting LoyaltyBoost Offers: Payload values facilitate rewarding users for engaging with partners through LoyaltyBoost Offers.

Payload values are specified within the properties of the window.AdpxUser object.

You can fill in these values either by using a server-side routine or by adding them client-side before initializing the SDK with thewindow.Adpx.init() call.

Setting init Attributes


For detailed information about passing payload values using the JS SDK, refer to Passing Payload Values



Verification of Integration Code 🎉

To ensure that your integration code has correctly been implemented:

  • Visit the page containing the integration code to confirm that Offers are displaying.
  • If you are passing payload values, verify that the preferred parameters are provided in the window.AdpxUser object.


📢 If you're running into any issues while going through the integration process, feel free to contact us at [email protected].