What it does
- Fetches offers with
offers.list(), optionally filtered by search text or category. - Renders each offer’s name, logo, category and cashback rate.
- On click, calls
openOffer()which opens a tracked link in a new tab and records the click.
Vanilla JavaScript
React / Next.js
Requires theuseCashbackHive() hook and the type declarations.
components/offers-widget.tsx
Design notes
Pinned offers come first.offers.list() returns pinned offers (ones you’ve featured in the publisher portal) before the rest. You can render them differently by checking offer.pinned.
Not every offer is clickable. clickUrl can be null for offers that don’t support click tracking. Disable the call to action for those; openOffer() throws if you call it on one.
Pass a sub-ID for your own reporting. If you want to attribute clicks to a placement, campaign or user on your side, pass subId:
clickId, subId and deeplink options.
Pagination. Use limit and offset, and the total field in the response, to page through large catalogues:
category, matching the category string on offers exactly: