Understand Bily
What does Bily do?
What does Bily do?
What are Bily Apps?
What are Bily Apps?
What is the difference between the SDK, API, and MCP?
What is the difference between the SDK, API, and MCP?
search and run focused work through execute.The API or MCP selection guide helps when a workflow crosses more than one surface.Where should I start?
Where should I start?
Do I need all three developer surfaces?
Do I need all three developer surfaces?
Install browser tracking
Should I use the raw script or the npm package?
Should I use the raw script or the npm package?
@bilyai/js for applications with an npm build, including React and Next.js.Install only one method on each website surface.Where do I find the tracking URL?
Where do I find the tracking URL?
Why must the exact tracking URL stay unchanged?
Why must the exact tracking URL stay unchanged?
Does Bily track the first page automatically?
Does Bily track the first page automatically?
PageView automatically. Do not send another page view from the initial mount.How do I track routes in a single-page application?
How do I track routes in a single-page application?
PageView after each later committed route. Include the final window.location.href and document.title.Skip the initial route callback and ignore repeated notifications for the same URL.See Page views.Can I call track() before Bily finishes loading?
Can I call track() before Bily finishes loading?
What does ready() prove?
What does ready() prove?
ready() confirms that the Bily browser runtime can accept queued calls. It rejects when loading fails or times out.It does not acknowledge a specific event or prove ingestion.Can I enable debug logging in production?
Can I enable debug logging in production?
debug: true temporarily while you validate a release. It logs SDK lifecycle details without logging event payloads.Turn it off after verification to keep the console quiet.What happens if init() runs twice?
What happens if init() runs twice?
init() with the same URL does not load another script. Bily ignores a different URL after loading starts or completes.Keep one configuration owner. Select the correct environment URL before the first call.Is the SDK safe during server rendering?
Is the SDK safe during server rendering?
track() becomes a no-op, ready() resolves, and getBilyTrackingId() returns null.Initialize Bily from client-mounted browser code.Design reliable events
Can I send custom events?
Can I send custom events?
track() accepts Bily’s known event names and any custom non-empty string.Use stable snake_case names for application outcomes. Keep changing IDs or values in the payload.Are event names case-sensitive?
Are event names case-sensitive?
When should an event fire?
When should an event fire?
workspace_created after creation succeeds, not when the user clicks submit.Which fields does the SDK add automatically?
Which fields does the SDK add automatically?
ts is absent and generates event_id when you do not provide one.Does event_id prevent duplicates?
Does event_id prevent duplicates?
event_id to identify one logical outcome and correlate related work. It is not an ingestion receipt or a promise of exactly-once delivery.Your application must still prevent duplicate triggers.How is an order total calculated?
How is an order total calculated?
order.total when it is a finite number. Otherwise, it calculates the total from each price and quantity in order.products.Zero is a valid total, tax, discount, or shipping value.Why are top-level products missing from an order event?
Why are top-level products missing from an order event?
order, put its items in order.products. Top-level products do not replace missing order.products for that event.Can custom properties contain any value?
Can custom properties contain any value?
How should I change an event contract after release?
How should I change an event contract after release?
Keep identity and attribution in scope
What is the Bily browser tracking ID?
What is the Bily browser tracking ID?
getBilyTrackingId() returns an identifier for the current browser context. The SDK keeps it stable in browser storage when possible.It is not a password, authenticated user ID, or authorization value.What happens when browser storage is cleared or blocked?
What happens when browser storage is cleared or blocked?
How do I attach an authenticated user ID?
How do I attach an authenticated user ID?
client.userId only to events that need authenticated customer context and that your consent policy allows.Does client.userId merge anonymous and known identities?
Does client.userId merge anonymous and known identities?
client.userId.Treat the value as context for that event. Do not describe matching email or user fields as an automatic merge.Does the SDK automatically define first-touch or last-touch attribution?
Does the SDK automatically define first-touch or last-touch attribution?
Which acquisition fields can I send?
Which acquisition fields can I send?
sourceUrl, pageTitle, and referrer for page context. Add reviewed custom properties for campaign or channel IDs.Remove sensitive query values. Never include credentials or session data.Read analytics consistently
What do conversions, people, sessions, and pageviews mean?
What do conversions, people, sessions, and pageviews mean?
conversions means orders. people means unique browser visitors. sessions means total 30-minute visits. pageviews means tracked page-view events.Keep these labels distinct.How should I calculate conversion rate?
How should I calculate conversion rate?
sum(conversions) / sum(people). Session CVR is sum(conversions) / sum(sessions).Multiply the ratio by 100 only when you present it as a percentage.Do not divide by orders, revenue, customers, purchase-only sessions, or rows already filtered to conversions. Those values exclude traffic that did not purchase.Why can’t I add platform spend across currencies?
Why can’t I add platform spend across currencies?
p_spend remains in each ad account’s native p_currency. Group raw aggregates by currency.Use Bily’s normalized channel or asset reports for store-currency spend and cross-account efficiency metrics.What is the difference between product orders and units?
What is the difference between product orders and units?
product_metrics, use sum(orders) for product orders and sum(units) for units. Do not use the row count for either metric.How does Bily define ROAS, CPA, and CAC?
How does Bily define ROAS, CPA, and CAC?
How does Bily define LTV?
How does Bily define LTV?
customer_ltv dataset defines LTV as a customer’s total lifetime revenue. Average LTV averages customer total_revenue. Net LTV subtracts refunds where available.Do not label this lifetime dataset as period new-versus-returning revenue.What is data readiness?
What is data readiness?
What does a quality warning mean?
What does a quality warning mean?
review_required results before making channel, budget, creative, or attribution decisions.What are connections, pixels, ad accounts, and assets?
What are connections, pixels, ad accounts, and assets?
Choose and operate the API or MCP
When should I use the Bily API?
When should I use the Bily API?
Can I call the Bily API from browser JavaScript?
Can I call the Bily API from browser JavaScript?
How do I discover my organization and store?
How do I discover my organization and store?
GET /context. It returns the authenticated user and accessible organizations, with stores nested under each organization.A standard store-scoped key needs no parameter. Copy the exact returned organizations[].stores[].url into store-scoped paths.Is a Bily API key store-scoped?
Is a Bily API key store-scoped?
Why does my older fallback key require store scope?
Why does my older fallback key require store scope?
GET /context or bily.context(), then revoke the older key.What is the difference between 401 and 403?
What is the difference between 401 and 403?
401 means the credential is missing, invalid, expired, or revoked. Reconnect or replace it.A 403 means the caller is authenticated but lacks the required permission, organization access, store scope, or action access. Confirm the requested scope.Should I retry a failed API request?
Should I retry a failed API request?
429, 500, 502, or 504 responses. Use capped exponential backoff with jitter.Do not automatically retry a write until a read shows whether the first attempt took effect.Why does Bily MCP expose only two tools?
Why does Bily MCP expose only two tools?
search discovers the current operation catalog at runtime. execute runs the selected bily.* helpers.This two-tool model keeps the top-level client contract stable as Bily operations evolve.Does MCP enforce a human approval step?
Does MCP enforce a human approval step?
execute function. Planning metadata alone does not prove human approval.What can execute() run?
What can execute() run?
bily.* helpers and has no direct outbound network access.It returns JSON-serializable result data with captured logs.What is the difference between Bily Connect and a fallback key?
What is the difference between Bily Connect and a fallback key?
Why did Bily Connect ask me to sign in again?
Why did Bily Connect ask me to sign in again?
Are llms.txt and llms-full.txt MCP endpoints?
Are llms.txt and llms-full.txt MCP endpoints?
docs.bily.ai.Use https://api-dispatcher.bily.ai/mcp as the MCP endpoint.Protect data and release with confidence
Can I send email, phone, or address data?
Can I send email, phone, or address data?
client object accepts these optional fields. Type support does not grant permission to collect them.Send only fields with a documented purpose, consent basis, and retention decision.What data must never be sent in a browser event?
What data must never be sent in a browser event?
Does the SDK manage consent for my application?
Does the SDK manage consent for my application?
track().Test consent-not-selected, accepted, denied, changed, signed-out, and signed-in states.Why can’t I see an event even though ready() resolved?
Why can’t I see an event even though ready() resolved?
ready() verifies loading, not ingestion.Confirm that the successful product path reached track() once. Check that the event name is non-empty, the page uses the intended tracking URL, consent allows the call, and the observed payload matches the event plan.Why do I see duplicate page views?
Why do I see duplicate page views?
PageView, registering several router listeners, or failing to deduplicate the current URL.Keep one script and one page-view owner.Why are early events missing?
Why are early events missing?
init(). Then check whether high-volume startup calls filled the bounded queue.When the queue reaches maxQueueSize, the SDK discards the oldest call.How should I validate a production release?
How should I validate a production release?
What should I send to Bily support?
What should I send to Bily support?