The Brij consumer app exposes a global API on window.brij that lets you attach arbitrary metadata from your brand's page to any action a customer takes on Brij — registering a product, claiming a rebate, uploading a receipt, or opting into SMS. These custom properties are stored client-side and automatically attached to the next Brij server call, then persisted on the customer record in your Brand Dashboard.
Quick start
Call brij.customData(key, value) anywhere on your page, before the customer interacts with the embedded Brij experience:
window.brij.customData('campaignId', 'summer-2026');
window.brij.customData('utm_source', 'newsletter-may');
window.brij.customData('storefront', 'shopify-us');
That's it. The values are automatically picked up by Brij and attached to the registration, rebate opt-in, or event record. No flush or send needed — it's automatic.
The API
Four methods are available on window.brij:
| Method | What it does |
|---|---|
brij.customData(key, value) |
Add or overwrite a single custom property. Returns { success: true } or { success: false, error: '...' } |
brij.getCustomData() |
Returns the current snapshot as { [key]: value, ... }. Useful for debugging. |
brij.clearCustomData() |
Wipe all custom properties for this browser session. |
brij.getCustomDataInfo() |
Get capacity stats: { fieldCount, maxFields: 50, remainingFields } |
Limits & rules
These limits are enforced client-side and must be respected:
| Limit | Value |
|---|---|
| Max number of distinct keys per session | 50 |
| Max key length | 100 characters |
| Max value length | 5000 characters |
| Allowed key type | Non-empty string (no objects or arrays) |
| Allowed value type | String only (not null, undefined, object, or array) |
To store structured data, stringify it yourself first:
window.brij.customData('cart', JSON.stringify({ sku: 'ABC-123', qty: 2 }));
Where the data lands
Custom properties appear on the resulting customer record in your Brand Dashboard:
- Product registration: Stored on the customer's registration record
- Rebate opt-in (SMS): Attached to the rebate event
- Receipt upload: Attached to the receipt submission event
- SMS opt-in: Attached to the opt-in event
All custom data is exportable via CSV from the Brand Dashboard.
Common use cases
- Campaign tracking:
campaignId,utm_source,utm_medium— tie registrations to your traffic source - Storefront context:
storefront,region,locale— track where the experience was embedded - Customer segment:
loyaltyTier,customerType— personalize follow-up based on segments you already know - Offer details:
offerCode,discountAmount— attach offer metadata to the registration
FAQ
Do I need to call a send() or flush() function?
No. Brij reads the custom data automatically the next time the customer triggers a server call (registration, rebate opt-in, etc.). Just set the values and move on.
Will the values survive a page reload?
Yes — they're stored in sessionStorage for that tab. They survive reloads within the same tab, but do not persist if the customer closes the tab or opens the URL in a new tab.
Can I store JSON objects?
Yes, but you must JSON.stringify() it yourself. The API rejects raw objects and arrays.
What happens if I push the same key twice?
The later value wins. Re-pushing an existing key never counts toward the 50-field cap.
Is brij.customData available immediately?
It's available once the Brij consumer app boots. If your script runs early, guard with if (window.brij && window.brij.customData) and retry in a few milliseconds.
Need help? If you encounter errors or need to debug what's being sent, check the browser console —
brij.customDataerrors are logged with a[brij.customData]prefix, and you can callwindow.brij.getCustomData()at any time to see the current snapshot.