Documentation Integration API Reference Android SDK Web SDK Publishers Advertisers Log in Get Started
Web SDK

Rewarded surfaces inside web apps.

Use the Web SDK when you want JavaScript control over web placements while keeping the same site key, user id and S2S reward contract.

OfferwallBannersSurveysPTC
Install

Add the browser SDK.

index.html
// Web SDK script
<script src="https://pro.adswedmedia.com/sdk.js" defer></script>
Initialize

Create a client with site context.

web-sdk.js
// Initialize Web SDK
const adswed=new Adswed({
  siteKey:"{site_key}",
  userId:"{user_id}"
});
Render

Open a monetization surface.

Use the same client to render the surfaces enabled for your site.

render.js
// Render supported surfaces
adswed.show("offerwall");
adswed.show("banners");
adswed.show("surveys");
adswed.show("ptc");
Events

Listen for client-side state.

Client events are useful for UI state. Use S2S postbacks for final reward settlement.

events.js
// Listen for Web SDK events
adswed.on("open", function(event) {
  console.log(event);
});

adswed.on("close", function(event) {
  console.log(event);
});
Server-side reward events

Connect S2S for settlement.

The Web SDK can open and track the browser surface. Your server should still verify credit, reject and chargeback events through the HMAC postback contract.

Read S2S Postback guide