Start with the decision you need to make
Write down the business decisions your implementation should support. For example:- which product journeys lead to checkout;
- where customers leave a conversion flow;
- which campaign and store results need regular review;
- which operational actions may be performed through the API or MCP.
Give every event an owner and proof
Use one row for each event. Review the plan with the product code.| Field | Question to answer |
|---|---|
| Event name | What stable outcome occurred? |
| Trigger | What exact successful state causes the event? |
| Owner | Which team owns the event contract? |
| Required properties | Which fields are necessary to interpret it? |
| Customer data | Which approved identity fields, if any, are needed? |
| Event ID | Can the same outcome be reported by more than one system? |
| Verification | How will a tester prove the event fired once with the right payload? |
Install Bily one way
| Website architecture | Installation path |
|---|---|
| Plain HTML or a site-managed script field | The exact raw script copied from Bily |
| Browser application with an npm build | @bilyai/js |
| React single-page application | One root-level React integration |
| Next.js App Router, Pages Router, or both | One shared client component mounted once in each active route tree |
Make one integration own page views
The browser script records the initial document page view. If your application changes routes without loading a new document, send one explicitPageView after each later committed route.
Choose one router integration to own those later page views. It should:
- skip the initial route callback;
- wait for the final committed URL;
- include the current URL and page title;
- ignore repeated notifications for the same URL.
Set identity and privacy boundaries
Keep these three concepts separate:- the Bily browser tracking ID identifies a browser context;
client.userIdcarries your approved authenticated account ID on an event;- your server session authorizes protected product actions.
| Classification | Examples | Default action |
|---|---|---|
| Operational | page name, product ID, plan, safe status code | Include when needed |
| Customer | user ID, email, phone, address | Include only with purpose and permission |
| Secret | password, session token, API key, payment data | Never include |
Give each developer surface one job
The browser SDK sends website events. It does not replace a server API client. Use the versioned Bily API for repeatable backend integrations and scheduled work. Use Bily MCP when a compatible AI client should discover current operations throughsearch and run focused work through execute.
The API or MCP selection guide helps you choose one surface—or combine them when the workflow needs both.
Prepare each environment before you build
For each environment, define:- which Bily store and tracking URL each environment uses;
- where test events are allowed;
- who can create or revoke server credentials;
- which checks must pass before production;
- how to disable the new tracking code without changing unrelated application behavior.
init() call.
Know when planning is complete
Start implementation when:- every event has an owner, trigger, required fields, and verification step;
- the team selected exactly one browser installation path;
- initial and SPA page-view ownership is explicit;
- optional customer fields have privacy approval;
- API and MCP credentials remain outside browser code;
- staging and production stores, URLs, and release gates are documented.
Model events and payloads
Turn your plan into a stable event contract.
Prepare the rollout
Release in stages with clear evidence and rollback criteria.