Configuration Parameters

You can configure the Thanks SDK by passing a single configuration object with the configuration parameters below. At minimum in order to function, you must provide your given partnerId. All other fields are optional and let you tailor data for targeting as well as capture events for handling the display. The same configuration shape is shared across widget, embed, and splash popup modes, with a small number of mode-specific additions.

ParameterTypePurpose
partnerIdStringYour Thanks-provided partner id
statusTextStringThe message to display on the Thanks splash screen.
embeddedIntoHTMLElement | HTMLElement[]Providing a HTML element here will enable the embedded Thanks widget (as opposed to the pop-up style widget). The embedded widget will be loaded into the provided element. If using multiple slots on a single page, an array of HTMLElements should be passed.
ui{ eventName?: string, orderNumber?: string }Let's you provide copy that may be used in Thanks UI elements. For example, "Order XYZ is on the way!"
slotStringDefines a size constraint for a embedded block.
emailString | ((factory: {encode: ( email: string | undefined, ) => Promise<string | undefined>;}) => Promise<string | undefined>)The customer email. This is hashed and then used for ad matching, and in cases where the customer must be sent a communication we can use it for autofill.Note: if this field is included then onPersonalInformationRequest is required.
emailHash{ sha256: String }The pre-hashed version of the customer email. Used only to exclude/include the customer from ads they have seen before.
allowLocalStoragebooleanAllows Thanks to store information on publisher's site.
enabledPersonalInformationSubjects{ relevance?: Boolean, autofill?: Boolean, notification?: Boolean }A list of PII subjects that you would like to opt in to. This provides a backwards compatible way for us to introduce new subjects.
onPersonalInformationRequest(subject: 'relevance' | 'notification' | 'autofill', { token: string, advertiser?: string, offerType?: 'coupon' | 'subscription' | 'transaction' })' => Promise<PersonalInformation>A callback to handle PII requests. Note: this field is required if a field like customer email is included. See below for an example payload and refer to Customer Data for more information.
customerLocation{ country?: 'US' | 'AU', postcode?: string }The customer's home location. Refer to Customer Data for more information.
purchaseLocation{ country?: 'US' | 'AU', postcode?: string }The customer's purchase location. Refer Customer Data for more information.
traceIdStringAn id enabling you to track widget activity.
keywordsString[]A set of keywords related to this activity.
categoriesString[]A set of categories related to this activity.
itemsCartItem[]A set of items purchased during this activity. See below for an example payload. See CartItem reference below for more info
style{ zIndex?: number, padding?: boolean, overlay?: boolean }Web SDK only. Style overrides for the Thanks widget (see Style Overrides below).
offsetTop() => numberA callback that provides the pixel value to offset the widget from the top of the screen. Defaults to 100px on desktop web and 70px on mobile web.
Web SDK. The callback is re-invoked on every window resize event, so the offset can be updated dynamically (e.g. when a sticky header changes height).
React Native SDK. The callback is invoked once when the widget initializes and is not re-evaluated. To change the offset after open, use the wrapperComponent to control the layout instad.
onDisplay() => voidA callback that will be called when the widget displays.
onClose() => voidA callback that will be called when the widget is closed.

Cart Item

FieldTypeRequiredDescription
namestringyesItem name
categorystringyesItem category
valuenumberyesItem price
currencystringyesISO 4217, e.g. "AUD"
quantitynumberyesQuantity purchased
eventobjectnoEvent details, for ticketing/experience items
event.idstringyes (within event)Your event identifier
event.namestringnoEvent name
event.categorystringnoEvent category, e.g. "concert"
event.venuestringnoVenue name
event.startAtstringnoISO 8601 start datetime

You may include additional properties on a cart item beyond these.

Please review the examples here

Style Overrides

ParameterTypePurpose
zIndexnumberThe z-index applied to the widget iframe. Defaults to 100. Increase if you have higher-stacked elements (e.g. modals, sticky headers).
paddingbooleanMobile viewport only. Set to false to remove the default side and top padding around the widget. Defaults to true.
overlaybooleanOnly for the Thanks Splash popup.Set to false to remove the semi-transparent shadow behind the widget (useful when your host page already provides its own dimming). Defaults to true.

ParameterTypePurpose
onLinkClick(url: string) => booleanA callback fired when a link inside the widget is clicked. Return true (or omit) to let Thanks open it instead; return false to handle it yourself.
onError(error: ThanksSdkError) => voidA callback invoked when the widget fails to load, initialize, or encounter a runtime error. The error object includes a code (e.g. HttpError, StartupTimeout, LoadingError, InitialisationFailed, NotEligible, WebviewError, PiiRequestFailed), a human-readable message, an origin of 'widget', and where available context and originalError for debugging.
wrapperComponentFC<{ children, onRequestClose, animationType?, transparent: true, isReady? }>A custom component used in place of React Native's Modal to wrap the widget WebView. Use this to control z-index, position, or visibility at runtime. The wrapper is a regular React component, so its own state can re-render and reposition the widget after it's open. Defaults to Modal.

Examples

onPersonalInformationRequest

We can also accept additional properties, please contact Thanks if you have additional properties you wish to pass in.

{
  email: "[email protected]",
  firstName: "Emma",
  lastName: "Jackson",
  phoneNumber: "+12025550125",
  dateOfBirth: "2000-09-15",
  age: 25,
  gender: "female"
};

items

Cart items can have any properties you wish to send, as an example:

{
  name: "Colourful stacking glass set",
  category: "gifts",
  value: 49.95,
  currency: "USD",
  quantity: 1
	premium: true
}

However you may have additional properties as you wish.

Event example:

{
  name: 'Tame Impala — Sydney',
  category: 'concert',
  value: 129.95,
  currency: 'AUD',
  quantity: 2,
  event: {
    name: 'Tame Impala',
    venue: 'Qudos Bank Arena',
    startAt: '2026-08-15T19:30:00+10:00',
    location: {
    region: 'NSW',
    city: 'Sydney',
    postcode: '2127',
    country: 'AU', // ISO 3166-1 alpha-2
    latLng: [-33.8475, 151.0637], 
    type: 'physical',
  },
}

Styling and Positioning

style.zIndex (web)

zIndex is read once when the widget iframe is created. To raise the widget above other high-stacked elements on the page:

<script>
  __thanks = {
    partnerId: 'YOUR_PARTNER_ID',
    style: { zIndex: 100000 },
  };
</script>

Changes to __thanks.style.zIndex after the widget is open are not picked up. If you need to re-stack the widget at runtime, set a high value up front.

offsetTop (web only)

offsetTop is re-evaluated on window resize. If your sticky header height changes without a viewport resize (e.g. it collapses on scroll), dispatch a synthetic resize so the widget re-reads it:

__thanks = {
  partnerId: 'YOUR_PARTNER_ID',
  offsetTop: () => document.querySelector('.site-header').offsetHeight + 20,
};

// after the header height changes:
window.dispatchEvent(new Event('resize'));

wrapperComponent (React Native only)

The React Native SDK currently does not honor style.zIndex or runtime offsetTop changes. For runtime control over layering and visibility, e.g. hiding the widget while an in-app browser is open and bringing it back, pass a custom wrapperComponent. It receives onRequestClose, animationType, transparent, and isReady props, and you can hold your own state inside it.

import { useState } from 'react';
import { View } from 'react-native';
import { ThanksWidgetController, thanksWidget } from '@thanksjs/react-native-webview';

const CustomWrapper = ({ children, isReady }) => {
  const [behind, setBehind] = useState(false);

  // expose a setter however suits your app
  globalThis.__setWidgetBehind = setBehind;

  return (
    <View
      style={{
        position: 'absolute',
        top: 0, left: 0, right: 0, bottom: 0,
        zIndex: behind ? -1 : 9999,
        display: isReady ? 'flex' : 'none',
      }}
    >
      {children}
    </View>
  );
};

// Set on the controller…
<ThanksWidgetController
  partnerId="YOUR_PARTNER_ID"
  wrapperComponent={CustomWrapper}
/>;

// …or pass per-open (overrides the controller value):
thanksWidget.open({ wrapperComponent: CustomWrapper });

When you open an in-app browser from onLinkClick, set __setWidgetBehind(true) before opening it and __setWidgetBehind(false) when it closes. The widget stays mounted (preserving customer journey state) but moves out of the way.


Did this page help you?