Skip to content

For a custom-built site, adding Frak is a matter of loading one script, setting one config object, and dropping in the components you want. Pick the setup that matches your stack below.

All three components are framework-agnostic web components, so they work the same whether you write plain HTML, use a bundler, or build with React.

ComponentWhere it goesWhat it does
<frak-button-share>Product page, homepageLets customers share your store and earn rewards
<frak-banner>Top of the pageWelcomes referred visitors
<frak-post-purchase>Order confirmation pagePrompts a share right after checkout, and tracks the order

Add this to the <head> of your pages. The config object is read by Frak when it loads, so set it before the script tag.

index.html
<head>
<!-- 1. Configure Frak (domain defaults to the current host) -->
<script>
window.FrakSetup = {
config: {
metadata: {
name: "Your Store",
currency: "eur",
},
},
};
</script>
<!-- 2. Avoid a flash of unstyled elements while the script loads -->
<style>
frak-button-share:not(:defined),
frak-banner:not(:defined),
frak-post-purchase:not(:defined) { display: none !important; }
</style>
<!-- 3. Load the components (auto-registers them and boots the SDK) -->
<link rel="dns-prefetch" href="https://sdk.frak.id">
<link rel="preconnect" href="https://sdk.frak.id">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<script
src="https://sdk.frak.id/components.js"
defer="defer"
onerror="var s=document.createElement('script');s.src='https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/components.js';s.defer=true;document.head.appendChild(s)"
></script>
</head>

sdk.frak.id is Frak’s first-party CDN pointer: a release reaches you in minutes, and onerror falls back to jsDelivr if it is ever unreachable. See the CDN / Browser integration guide for how the fallback and preconnects work.

Place the banner near the top of your <body>, and the share button wherever you want customers to share:

<body>
<!-- Welcomes referred visitors -->
<frak-banner></frak-banner>
<!-- Inherits your theme's .button styles via classname -->
<frak-button-share classname="button"></frak-button-share>
</body>

On your order confirmation page, add the post-purchase card with your order details. When customer-id, order-id, and token are all present, the card also registers the order with Frak automatically:

<frak-post-purchase
customer-id="cust_123"
order-id="order_456"
token="a-unique-order-token"
></frak-post-purchase>

If you do not want to show the card, register the order directly instead. The action becomes available once Frak is ready:

<script>
window.addEventListener("frak:client", () => {
window.FrakSetup.core.trackPurchaseStatus({
customerId: "cust_123",
orderId: "order_456",
token: "a-unique-order-token",
});
});
</script>