JS SDK (for Websites)
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.
Before starting the integration process with the JS SDK, ensure you have the following:
The following playable demo will guide you through the steps required to integrate the AdsPostX JavaScript SDK with a website.
- 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.
- 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.
When 'dev' is set to 'true', the sandbox environment is enabled for testing purposes only, with no activity recorded in production. In this mode, geo-targeting is ignored for publishers, ensuring that all offers are returned in ad responses for comprehensive testing.
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.
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.
Learn more about Showing the Moments Unit |
settings | Object optional | 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 | 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.
Want to embed the Web SDK to your website? Check out our guide here to learn how.
To identify a customer, fill in the global window.AdpxUser object's properties with the customer information. This payload is sent to AdsPostX.
You can fill in these values either using a server-side routine or by adding them client-side before initializing the SDK with thewindow.Adpx.init() call.
You have the flexibility to include custom key-value pairs in the payload.
Value | Description |
User email | |
firstname | User first name |
zipcode | User zip code |
mobile | User Mobile Number |
confirmationref | Can be used to associate a confirmation number with the AdsPostX request. This reference can then be used in macros for personalizing AdsPostX units to better suit your needs. |
country | The user country payload. It should be in the ISO 3166-1 alpha-2 2-character country code. Example: If the user is from the United States, country: US |
If you need to add or update payload data after initialization, refer to the section on Delaying the Moments Offer Unit
To uniquely identify a user, AdsPostX uses various signals and inferred uniqueness. However, you can provide your identifier using the adpx_fpattribute in the window.AdpxUser object.
This identifier can be any unique string or hashed value. It helps AdsPostX utilize this value to distinguish individual users, applying frequency caps and preventing repeated displays of Offers when a user opts out.
To better analyze the performance of your AdsPostX units and segment traffic, consider including a subid parameter in the customer object. Replace the value with any text you prefer to track impressions, clicks, and conversions.
You can use the tagsattribute to provide additional context for more relevant and personalized Offers.
You can pass the value either as a comma-separated list of values or as a JavaScript array of strings.
You can also add any custom key-value payload attributes to include additional details. These attributes are passed back on conversion reports and can be used for analysis related to impressions and clicks.
For example, you can pass custom attributes like membershipID and source:
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].