Welcome to example Vanilla JS



1. Placement on Components

Components with a placement attribute read trigger config (text, position, clickAction) from the backend-resolved placement. Configure placements via the business dashboard's merchant sdkConfig.

Placement IDs must match entries in the merchant's sdkConfig.placements. If no match, components fall back to HTML attributes / defaults.

No placement (default)

placement="hero-share"

placement="sidebar-promo"

placement="footer-cta"

2. Placement on Modals

Programmatic displayModal() calls with an optional placement parameter. The listener applies placement-scoped translations and CSS on top of global config.

3. Sharing Page

Programmatic displaySharingPage() call opens a full-page sharing UI with product info, estimated rewards, sharing steps, FAQ, and share/copy buttons.

The promise resolves on first share/copy action. The page stays visible for additional interactions.

[Ready] Click a button to trigger the sharing page

4. Post-Purchase Component

The <frak-post-purchase> web component renders an inline card on thank-you / order-status pages. It shows referral rewards and a share CTA.

Rendered in preview="true" below so the cards stay visible without a backend referral status. At runtime the variant (referrer vs referee) is auto-detected from the user's referral state.

Default (built-in gift icon)

Custom image (image-url)

Live card with an order token (token)

Not a preview, so the CTA is live: clicking it opens the sharing page and forwards token as the checkoutToken, which is how a buyer with no frak-client-id still gets an install link. Renders only once the SDK resolves a referral status.

5. Banner Component

The <frak-banner> web component auto-detects its mode: in-app browser detection (priority) or referral success banner. Uses Light DOM to inherit merchant styles.

Rendered in preview="true" below so the referral banner stays visible without firing a real referral event.

Default (built-in gift icon)

Custom image (image-url)

6. Auto-share via Query Param

Visiting a URL with ?frakAction=share auto-opens the full-page sharing UI on load. Email tools (Klaviyo, Omnisend, Customer.io…) can deep-link customers straight into a contextualised share by adding optional link, products and placement query params.

Copy a link or open it in a new tab — once the SDK initialises on the new page, the sharing page opens automatically.

Without product

With products (Klaviyo-style)

7. Share into the native example apps

Builds a FrakContext v2 referral link targeting the native harnesses in example/native-ios and example/native-android. The fCtx query param is decoded natively and tracked as a referral arrival: on iOS the harness forwards onOpenURL to Frak.client.appLink.handleReferral(url), while Android needs no host code at all — DeepLinkHandling.Automatic reads the intent itself.

Both harnesses only declare the merchantapp:// URL scheme (iOS has no associated-domains entitlement, and the Android https://example-merchant.com/product filter is not autoVerify'd), so that scheme is the link target on both platforms. The link carries the native harnesses' merchant id — the native SDK drops an arrival whose fCtx merchant doesn't match the app's own. On a non-matching platform the button falls back to the native share sheet / clipboard.

[Ready] Detecting platform…

Identity Merge Demo

This demonstrates cross-browser identity linking. Useful when users navigate from social app browsers (Instagram, TikTok) to external browsers via SSO/OAuth flows.

Note: Arriving with a ?fmt= merge token in the URL is logged below; the listener processes it and links the identities.

Your anonymousId: Loading...

[Ready] Merge token demo initialized