clickUrl — a template for a Cashback Hive redirect link. When a shopper follows it, Cashback Hive records the click and forwards them to the retailer, so any resulting purchase is attributed to your property (and to the signed-in member, if there is one).
openOffer() vs trackingUrl()
Prefer
openOffer() for user-initiated clicks. If you render tracked URLs into <a> tags with trackingUrl(), Cashback Hive still records the click server-side when the link is followed, but the SDK’s click event and client-side beacon won’t fire.Options
Both methods accept the same tracking options.string
Your own identifier for this click. Substituted into the
{PublisherClickID} placeholder. Defaults to a random UUID generated by the SDK. Use this if you want to correlate Cashback Hive’s click records with your own logs.string
Free-form attribution label — a placement, campaign, page section or hashed user ID. Substituted into
{SubId}. Defaults to an empty string. Appears in your reporting.string
A specific retailer URL (e.g. a product page) to land on instead of the retailer’s homepage. Only used when
offer.supportsDeeplinking is true; ignored otherwise. Substituted into {DeepLink}.boolean
default:"true"
openOffer() only. Open in a new tab (window.open with noopener) or navigate the current tab (location.assign).Passing a slug instead of an offer
Both methods accept either an offer object or a slug string. When you pass a slug, the SDK looks it up in its offer cache, which is populated byoffers.list() and offers.get(). If the slug isn’t cached, the call throws:
openOffer("nike") on a fresh page load without fetching first will throw. When in doubt, pass the offer object.
Offers without tracking
clickUrl is null for offers that don’t support click tracking. trackingUrl() and openOffer() throw for these:
offer.clickUrl before rendering a call to action, and disable or hide it when it’s null.
Listening for clicks
openOffer() emits a click event you can use for your own analytics:
Popup blockers
openOffer() with the default newTab: true calls window.open. Browsers allow this only inside a user gesture (a click handler). If you call it asynchronously after a click — for example after awaiting an API call — the new tab may be blocked. Either fetch what you need before the click, or use newTab: false.