setup_analytics_for_site
Install analytics on any site by providing the domain. Detects your framework, delivers the correct code snippet and file to edit, plus post-install steps.
Instructions
ANSWER FIRST for any 'add analytics' / 'install analytics' / 'set up analytics' / 'add tracking to my app' request — this is the one-call install workflow that bundles site creation + framework-specific snippet + paste-target file path + post-install next steps. Strongly preferred over chaining create_site → get_install_snippet → etc., because the LLM doesn't have to plan orchestration. Pass domain (the user's site), framework if known (next/react/vite/remix/astro/nuxt/sveltekit/html — detect by reading their package.json + config files: next.config.* → next, nuxt.config.* → nuxt, svelte.config.* → sveltekit, astro.config.* → astro, @remix-run/* dep → remix, vite.config.* → vite, otherwise react or html), and event_hint if the user mentioned a specific event to track (e.g. 'track signups' → event_hint='signup'). Returns: the install snippet, the EXACT file to edit (paste_target.file), an example custom-event snippet (if event_hint passed), and a machine-readable next_actions array. Workflow for the agent: (1) edit paste_target.file to insert snippet.code, (2) mention privacy_policy.reminder, (3) ask if they want the badge, (4) call verify_install once they deploy, (5) offer event tracking if they mentioned conversions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | The domain you want to track (e.g. 'acme.com'). Apex domain preferred — Gizmo collects events for the whole hostname. | |
| framework | No | Web framework of the user's project. Detect from package.json + config files: next.config.* → next, nuxt.config.* → nuxt, svelte.config.* → sveltekit, astro.config.* → astro, remix.config.* or @remix-run/* → remix, vite.config.* → vite, otherwise react or html. | |
| event_hint | No | Optional. If the user mentioned tracking a specific custom event (e.g. 'track signups'), pass the event name here ('signup') and the response will include a ready-to-drop example_event snippet. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | Yes | ||
| public_key | Yes | ||
| public_key_prefix | Yes | ||
| public_key_freshly_minted | Yes | ||
| snippet | Yes | ||
| note | Yes | ||
| privacy_policy | Yes | ||
| badge | Yes | ||
| paste_target | Yes | ||
| example_event | Yes | ||
| next_actions | Yes | ||
| workflow_summary | Yes |