Skip to main content
The Offers widget shows the cashback offers available to your property and sends shoppers to the retailer through a tracked link when they click.

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 the useCashbackHive() hook and the type declarations.
components/offers-widget.tsx
In production you’ll want to debounce query so you don’t call the API on every keystroke. The vanilla example above shows a 250 ms debounce.

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:
See Click tracking for clickId, subId and deeplink options. Pagination. Use limit and offset, and the total field in the response, to page through large catalogues:
Categories. Filter with category, matching the category string on offers exactly: