Skip to main content
See Click tracking for guidance on when to use each method and how attribution works.

openOffer()

Build a tracked URL for an offer, record the click, and open the retailer.
string | Offer
required
An Offer object, or the slug of an offer previously returned by offers.list() or offers.get().
string
Your identifier for this click. Defaults to a random UUID.
string
default:"\"\""
Free-form attribution label for your reporting.
Retailer URL to land on. Only applied when offer.supportsDeeplinking is true.
boolean
default:"true"
true opens the URL with window.open(url, "_blank", "noopener"). false navigates the current tab with location.assign(url).
Side effects, in order:
  1. Emits the click event with { slug, url }.
  2. Sends an offer_click analytics beacon with { slug, subId }.
  3. Opens the URL.
Throws synchronously if the SDK isn’t initialised, if a slug isn’t in the offer cache, or if the offer has no clickUrl. See Errors.

trackingUrl()

Build a tracked URL without opening it or recording a client-side click.
Accepts the same offer, clickId, subId and deeplink parameters as openOffer() (there is no newTab). Returns the fully substituted tracked URL. Following this URL still records the click server-side at Cashback Hive; only the SDK’s click event and offer_click beacon are skipped. Throws under the same conditions as openOffer().

How the URL is built

Each offer’s clickUrl is a template containing placeholders. trackingUrl() substitutes them, URL-encoding each value: The resulting URL points at https://shop.cashbackhive.com/click/… (or https://click.invalid/… in mock mode).