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.
string
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).- Emits the
clickevent with{ slug, url }. - Sends an
offer_clickanalytics beacon with{ slug, subId }. - Opens the URL.
clickUrl. See Errors.
trackingUrl()
Build a tracked URL without opening it or recording a client-side click.
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’sclickUrl 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).