Website analytics

Set a site's goals

analytics_set_goals · Changes data · Markdown

Sets the conversions a site counts: pages reached or events, replacing its goals; with notify, the agent hears of each one as it happens.

Free

This tool costs nothing to call.

An example

Count it as a conversion whenever someone finishes checkout or signs up for the newsletter.

Your agent callsanalytics_set_goalsFree

The example business is Halverson Cycle & Repair, a bike shop with a repair workshop in Portland, Oregon. The reply is the one the tool really gives.

With these arguments
{
  "site": "halversoncycle.example",
  "goals": [
    {
      "name": "Order placed",
      "page": "/checkout/done"
    },
    {
      "name": "Newsletter",
      "event": "Subscribe"
    }
  ]
}
What comes back
{
  "site": {
    "site_id": "2c0bddc7-d636-4cee-8341-90a8c41a1efd",
    "domain": "halversoncycle.example",
    "name": "Halverson Cycle & Repair",
    "time_zone": "America/Los_Angeles",
    "snippet": "<script defer src=\"https://cncto.co/a.js\" data-site=\"2c0bddc7-d636-4cee-8341-90a8c41a1efd\"></script>",
    "events_this_month": 13,
    "clicks_this_month": 0,
    "allowance_per_month": 100000,
    "extra_blocks": 0,
    "monthly_usd": "$3.00",
    "goals": [
      {
        "name": "Order placed",
        "page": "/checkout/done"
      },
      {
        "name": "Newsletter",
        "event": "Subscribe"
      }
    ],
    "events": [],
    "spike_alert_visitors": null,
    "weekly_summary": false,
    "track_errors": false,
    "keep_sources": true,
    "created_at": "2026-10-14T08:00:00+00:00"
  }
}

Use it when

The business wants to know how many visitors did something that matters: ordered, signed up, booked.

What it does

The conversions to count, replacing the site's goals: a page reached ({"name": "Order placed", "page": "/checkout/done"}) or a custom event, optionally with props ({"name": "Pro signup", "event": "Signup", "props": {"plan": "pro"}}). analytics_stats then shows each goal's visitors, conversions, conversion rate and revenue (from conecto("Purchase", {...}, {revenue: 49.9, currency: "USD"})). An empty list removes them.

What comes back

The site, with the goals it now counts. Every reply also carries cost_usd and balance_usd.

Inputs

NameTypeWhat it is
siteRequiredstringThe site's domain (e.g. halversoncycle.example) or its site_id. 4 to 253 characters.
goalsRequiredarray of objectsUp to 20 items.
goals[].namestringUp to 60 characters.
goals[].pagestringA page reached, like /thanks or /order/*/done. Up to 500 characters.
goals[].eventstringA custom event, like Signup, or one analytics_define_events made. Up to 60 characters.
goals[].propsobjectOnly events with these props, like {"plan": "pro"}.
goals[].notifybooleanSend analytics.goal_completed the moment a visitor reaches it, with where they came from and what they saw.

The call

Over MCP, call analytics_set_goals on https://api.conecto.chat/mcp/analytics. Over REST:

Terminal
curl -X POST https://api.conecto.chat/v1/tools/analytics_set_goals \
  -H "Authorization: Bearer $CONECTO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"site":"halversoncycle.example","goals":[{"name":"Order placed","page":"/checkout/done"},{"name":"Newsletter","event":"Subscribe"}]}'

When it refuses

A refused call costs nothing and says what to do next.

CodeWhenWhat to do
not_found404No site the business counts has that domain or site_id.Call analytics_list_sites and use a domain from it.
invalid_input400A goal has no name, two goals share a name, or a goal is not exactly one page or one event.Give each goal its own name and either a page like /checkout/done or an event like Subscribe.

Give this to your agent.

Set up Conecto from https://conecto.chat/SKILL.md