Publishers · Ad formats
Task
A compact native row in your task list. The user opens the offer, comes back and claims a reward.
Earn
Join Crypto News
+100 coins
Play Tower Rush
+250 coins
Follow on X
Done ✓
What your user sees
A compact row: icon | title + reward | button. It looks like a normal task in your list.
- User taps the button → advertiser opens.
- User stays there at least 15 s and comes back.
- Button turns into Claim → user gets the reward.
Code
Put the element where you want the task to appear. That's it.
<adsun-task data-block-id="task-50003">
<span slot="reward">+100 coins</span>
</adsun-task>
<script>
const task = document.querySelector("adsun-task");
task.addEventListener("reward", (e) => {
// e.detail = block id → update the user's balance (from your server)
});
task.addEventListener("onBannerNotFound", () => task.remove()); // hide when empty
</script>Custom buttons and texts
<adsun-task data-block-id="task-50003">
<span slot="reward">+100 coins</span>
<button slot="button">Go</button>
<button slot="claim">Claim reward</button>
<span slot="done">Completed</span>
</adsun-task>Attributes
| Attribute | What it does |
|---|---|
data-block-id | Your Task block ID (required) |
data-debug | "true" shows a test task |
data-debug-console | Logs to the console in debug |
data-tasks-count | How many tasks to show |
data-task-refetch-after | Seconds before a new task loads (default 30) |
data-force-campaign-id | Show one specific campaign (testing) |
Events
| Event | When |
|---|---|
reward | Task completed — give the reward |
onBannerNotFound | No task available |
onFastReturn | User came back too fast (< 15 s) — no reward |
onTooLongSession | App open for more than 4 hours — ask to restart |
onFocusOut / onFocusIn | User left / returned to your app |
leave / return | Same moments, fired together with the two above |
onError | Something went wrong — reason in event.error |
Want it to match your design? See Task styling.
Still stuck? Write to support@adsun.io or our Telegram support — we answer fast.