What it is
Mode Metrics takes records from the systems your business already runs on, with your own credentials, and stores each one beside your site's and app's events.
A deal that moves stage in your CRM, a mail your provider delivered or a reader opened, a text that failed, a support ticket, an app store review, a sale an affiliate drove, a call or a receipt at the till. Each becomes an event, a conversion or revenue, joined to the visitor or person it is of, so funnels, attribution and lifetime value see it with no code on your side.
A conversion a system reports reaches the ad platforms and partners that take its goal, as any conversion does, so a sale closed by your sales team is sent to the ad that brought the lead.
Connect a system
Pick the system, give its credentials, then give the system the address Mode answers on.
- Open Metrics, then Systems, and pick the system under Connect a system
- Name it, so two accounts of one system can be told apart, and give the credentials it lists
- Copy the address on its page into the system's webhook settings, following the steps shown there
Credentials are sealed when you give them and never shown again. You can replace them on the system's page. A system Mode reads by polling needs no address, it is read each hour from where it left off, and your own database each minute. Google Search Console connects with its Connect Google Search Console button instead, see Search keywords.
Signatures and the address
Every request is checked against the system's own signature before anything in it is read.
Each system signs the way its own documentation says, an HMAC of the body, a signed timestamp, a signed token or a shared password, and Mode checks that scheme with the secret you gave. A request that is not signed by the system, sent to an address that is not yours, or sent to a system you paused gets the same refusal.
A system that checks the address before it sends, by echoing a challenge, is answered as it expects.
Who a record is of
One set of rules joins every system's records to people, the same for every system.
Mode tries, in order, a visitor id the record carries, the visitor reference Mode's snippet puts into forms, checkout links and embeds, a Mode click id, the system's own id of a record the page already sent, an earlier conversion of the same record, an ad platform's click id, and then the email address or phone number, which is hashed the moment it arrives and never stored. A record no rule joins is kept as the system's own and still counted.
To join the most records, keep the hidden fields Mode's snippet adds to your forms, and store a Mode click id or an ad click id on your CRM records where your CRM allows it.
Counted once, never lost
A record that arrives twice is stored once, and a request Mode could not read is kept until it can be.
Every record is keyed by the system's own id of it, so a webhook the system retries, a page polled again or a request read again stores and counts nothing new. A request whose body Mode could not read, or could not store at that moment, is kept as it came for 30 days, with the field that failed and why, and read again each hour and whenever you change the system's settings. The system's page shows how many are kept and why.
CRMs
Salesforce, HubSpot, Pipedrive, Close and Attio, read every hour with your own key.
Each lead, contact and deal that reaches a stage becomes a stage event, and a stage you map to a goal becomes a conversion worth the deal's amount, counted once a deal and a goal. That conversion goes to the ad platforms that take its goal as an offline conversion, so the ad that brought a lead is credited when your sales team closes it. A lost deal is never a conversion.
- Create the key the system's page asks for, with read access to deals and contacts
- Connect the CRM under Systems and give the key
- Under Stage to goal, map your stages to goals, such as your won stage to crm_won
A deal joins its visit by its contact's email or phone, hashed on arrival, or by the fields Mode's form fields fill (mode_distinct_id, mclid, gclid and the other ad click ids) when you keep them as CRM fields. Name your own field names under the fields setting.
Support desks
Intercom, Zendesk, Help Scout and Front, by their signed webhooks.
Tickets created, replied to (by an agent or the customer), assigned, solved and reopened, and satisfaction ratings, each with the ticket's channel, priority and status, never the text. A ticket joins its person by the requester's email, the desk's own id of the requester, or a custom attribute that holds the Mode visitor.
- Connect the desk under Systems and give the webhook's signing secret
- In the desk's webhook settings, paste the address shown and pick the ticket events
App store reviews
App Store and Google Play reviews of your apps, read every hour with your own API key.
Each review becomes a review event with its rating, country or language, app version and whether you answered it. The reviewer's name is never kept, and the review's text only when you turn text on.
- For the App Store, make an App Store Connect API key with the Customer Support role, and give its issuer id, key id, the key file's text and the app's Apple ID
- For Google Play, give a service account key that Play Console lets reply to reviews, and the app's package name
Email providers
SendGrid, Postmark, Mailgun, Resend, Amazon SES, Mailchimp, Mailchimp Transactional, Klaviyo, Customer.io, Kit and Brevo, by their own webhooks.
Mail sent, delivered, opened, clicked, bounced (hard or soft), deferred, dropped, marked as spam, unsubscribed and subscribed, each with the provider's message id, the campaign or list where it gives one, the clicked link's host and path, and the bounce code. An open or click made by a mail privacy proxy or a link scanner is flagged as a machine's, and the address, the subject and the text are never kept. Mail you send with Mode Relay is tracked already.
- Connect the provider under Systems and give the secret it lists, such as the webhook's signing key
- In the provider's webhook settings, paste the address shown and pick the mail events
- To join each mail to its visitor, send it with a custom field named mode_distinct_id, mclid or mode_ref, as each provider's steps say
A mail with none of those joins its visitor by the recipient's address, hashed the moment it arrives. Amazon SES posts through an SNS topic, whose name you give, and Mode confirms the subscription itself.
Messages you send through Meta's WhatsApp Business platform, sent, delivered, read or failed.
Each status carries the message id, the error code of a failure and the pricing category, never the text. It joins its person by the recipient's number, hashed on arrival, or by mode_distinct_id in the message's callback data. WhatsApp sent through Twilio or Vonage arrives through those systems' own connections, with the same events.
- Connect WhatsApp under Systems with your Meta app's secret and a verify token you choose
- In your app's WhatsApp configuration, set the callback URL to the address shown and the same verify token, then subscribe to messages
Mail from any other system
An open pixel and tracked links for mail you send from a system Mode has no connector for.
Ask for the open pixel of a message and its recipient, and put the image in the mail's HTML. Each open becomes an email opened event, counted at most once an hour for one reader and message, with opens by mail privacy proxies flagged. The address is hashed into the pixel and never kept, and the reader joins their visitor by it, or by their Mode id when you give it. Put the mail's links through tracked short links too, so each click is counted.
| Do | HTTP | MCP tool |
|---|---|---|
| The open pixel of a message | POST /v1/metrics/systems/email-pixel | email_open_pixel |
| Tracked links in a mail | Through the MCP server | wrap_email_links |
Affiliate networks
Pick the network, give its ids and credentials and the goals it pays on, and Mode reports each conversion to it server to server.
The network's own click parameter becomes a sub id of your sources, so it rides from the landing to every conversion with no change to your pages. A conversion your server or your biller reports, or one made visits later, carries the person's last one from the 90 days before it. Each goal you pick becomes an outbound postback with the network's documented call, and any secret is sealed in a header and never shown again.
| Network | Click parameter | What it needs | The call |
|---|---|---|---|
| Impact | irclickid | Account SID, auth token, campaign ID, action tracker ID | POST https://api.impact.com/Advertisers/{AccountSID}/Conversions with the click, the order, its time, its value and currency |
| PartnerStack | ps_xid, ps_partner_key | Conversion token, API public and secret keys, a signup goal and the goals a sale is made on | The signup to partnerlinks.io/conversion/xid, each sale to /api/v2/transactions in cents, both under the person's distinct id |
| CJ | cjevent | Enterprise ID and action tracker ID | https://www.emjcd.com/u with METHOD=S2S, the order, its time, its value and currency |
| Awin | awc | Advertiser ID, and a commission group if not DEFAULT | The direct server to server call, https://www.awin1.com/sread.php |
| Rakuten Advertising | ranSiteID, ranEAID | The server to server address in your Rakuten integration guide, with Mode's macros where its values go | That address, with the landing time as {sub_at:ransiteid} in the format the guide asks for |
ShareASale closed in October 2025 and its programs moved to Awin, so connect a former ShareASale program as Awin. Every send is in the delivery log, and Impact can also tell Mode which sales it approved or reversed ($affiliate_commission_approved and $affiliate_commission_reversed) by connecting the Impact system and adding an Action Lifecycle postback to its address with the token you set.
Creator codes
Give each creator their discount code, and every sale paid with it is credited to them, from any billing source.
Mode reads the codes every sale was paid with, from Stripe and from every other revenue source, and records a sale with a creator's code as a conversion of the goal you name (creator_sale unless set), with its value, its currency and its order, once per order. It reaches the ad platforms and partners that take that goal like any conversion. A refund or a chargeback of that sale reverses it. A code moved to another creator keeps its history, so a sale is credited to whoever held the code that day.
The report by creator shows each creator's sales, revenue, refunds and net per currency, beside the reach of their posts.
Creator posts with no link
Count the posts creators made about you through each platform's own API, read once a day. Mode never reads a platform's pages.
| Platform | Read with | What it counts |
|---|---|---|
| YouTube | Your own YouTube Data API key, and the videos you list by id or link | Views, likes and comments. YouTube's policies keep statistics read this way 30 days, so each day's reading is deleted after 30 days |
| Your brand's own Instagram professional account token | Your posts' views, reach, likes, comments, shares and saves, and the likes and comments of posts your account is tagged in | |
| TikTok | A token the creator grants your TikTok app through TikTok's Display API, one account per creator | The creator's videos' views, likes, comments and shares. TikTok offers no other permitted way to read a creator's counts |
Each post is a $creator_post_stats event a day with the creator's handle, which joins their posts to their code sales.
Search keywords
What people searched before they reached your site, by query, page, country, device and day, from every search engine that gives a site's owner that data.
| Engine | Connect with | What it reads |
|---|---|---|
| Google Search Console | Connect Google Search Console, read only. Or your own Google app's refresh token with its client ID and secret, or a service account you add as a user of each property | Clicks, impressions, CTR and average position by query, page, country, device and day for web, image, video and news results, and by page for Discover and Google News, with the 16 months Google keeps |
| Bing Webmaster Tools | Your API key, from Settings, then API access | Clicks and impressions by day, and clicks, impressions and average position by query and by page, by week as Bing gives them. Searches on Yahoo, DuckDuckGo and Ecosia are answered from Bing's index and are counted here |
| Yandex Webmaster | An OAuth token of your Yandex app with the webmaster:hostinfo scope, and its refresh token, client ID and secret so Mode renews it | Shows, clicks and average position by day, in total and for the top queries |
Brave Search, Kagi, DuckDuckGo, Yahoo and Ecosia give site owners no keyword data of their own. A visit from any of them still shows in Metrics as organic search.
Every engine lands in the same three tables, each row naming its engine, so SQL, insights, dashboards, alerts, the API and MCP read them like any other source.
| Table | One row per |
|---|---|
search_queries | Engine, site, search type, day, query, page, country and device |
search_pages | The same by page, with no query |
search_totals | The same by day, the engine's own totals, which include the rare queries engines leave out of query rows for privacy |
Each holds date, engine, site, search_type, period (day, or week where Bing answers by week), clicks, impressions, ctr and position, with query, page, page_path, country and device where the table has them. page_path joins a landing page to Metrics' own page views and sessions.
A new connection reads the newest days first and then every day back to the oldest the engine keeps. Each day after, it reads the last four days again, since engines restate them, and the newest. A day read again replaces itself and counts no source rows twice. Read now on the system's page reads it at once. Refused access or a refused key turns the system's health critical and emails the org's owners.
The first engine you connect makes a Search dashboard, clicks, impressions, CTR and average position against the period before, clicks, impressions and position by day and engine, top queries, and top landing pages with the sessions Metrics saw enter on each from organic search. It is yours to change or delete like any other.
Tracking pipelines and webhooks
A team that already sends its events through Segment, RudderStack or mParticle, or from Zapier, n8n or any system's webhook, sends them to Mode with no change to its code.
| System | How it sends |
|---|---|
| Segment | The Webhooks destination with your write key as its shared secret, or a Segment library whose host is the system's address. The address takes the tracking API's own paths after it, such as /v1/batch |
| RudderStack | A Webhook destination with an x-mode-key header, or an SDK whose data plane address is the system's address |
| mParticle | The Webhook output with an Authorization: Bearer header of your write key |
| Zapier | Mode's Zapier app, connected with the address and write key, with Track Event, Identify Person, Set Group and Merge People |
| n8n | Mode's n8n node, with the same four calls |
| Any webhook | An HMAC of the body under a secret, and a mapping that names where each event's name, person, time, id and properties are in the body |
A track is the event it names, and the spec's own names (Order Completed, Product Added, Signed Up, Subscription Started and the rest) become Mode's shared ones, so an order sent this way and one a webhook saw are one $purchase, counted once. A page is a $pageview, a screen a $screen, identify links the visitor to your user and sets their properties, group sets a group and alias merges two ids. The visitor's address, browser and campaign carry over, so locations, bots and sources read the visitor. Email, phone and name traits are kept as person properties only when you allow it on the system. Each message is keyed by its messageId, so a retry is counted once.
CDN and server logs
Your CDN's or server's access logs show what never runs the snippet. Pages fetched with no script, files downloaded from a direct link, feed readers, podcast apps, AI crawlers and agents on your real site.
| System | How it sends |
|---|---|
| Cloudflare logs | A Logpush job of the HTTP requests dataset to the system's address, with your token as an Authorization header (header_Authorization in the destination) and at most 1,000 records a batch |
| Vercel logs | A log drain in JSON, signed with its secret, and answered with the verification code Vercel shows |
| Netlify logs | A general HTTP log drain of traffic logs to the address with ?token= and your token |
| Fastly or server logs | An HTTPS logging endpoint in the JSON format the system's setup gives, or nginx and Apache combined log lines |
| Logs in a bucket | A read only key to the bucket your CDN or server writes S3 access logs, CloudFront standard logs or combined logs to. Mode reads each new file once |
A page becomes a $pageview marked no_script, a document, archive, installer or video a $file_download, a feed a $feed_fetch with the reader's subscriber count where it states one, and an audio file a $podcast_download. Scripts, styles, images, API calls, redirects and errors are left out. Every event is sent cookieless with the visitor's address and browser, so the visitor is counted the way a cookieless page counts them, bots are scored and classed as on any page, and the address is stored only as your consent policy allows.
A page a person's browser fetched is sent only when the snippet did not already count the same page and browser within two minutes, so a visit is counted once. A page whose log reaches Mode before the snippet's own view is stored can still count twice, and is marked no_script, so a report can leave it out. A body too large to keep that can't be read is answered 503 with Retry-After, so the drain sends it again.
History from other tools
Switching to Mode keeps your past. Connect the tool you used with your own key, pick the days, and Mode reads them a day at a time with their own dates.
| Tool | What Mode reads | With |
|---|---|---|
| PostHog, cloud or self-hosted | Every event, people's properties, identities and groups | A personal API key with query read, the host and the project id |
| Mixpanel | Every event, then every profile, in the US, EU or India | A service account and the project id |
| Amplitude | Every event, an hour at a time, with user properties, in the US or EU | The project's API key and secret key |
| Google Analytics 4 | Every event of its BigQuery export | A service account key with BigQuery read access, the project and dataset |
| Heap | Every event and page of Heap Connect in BigQuery, with identities | A service account key, the project and dataset |
| Matomo, cloud or self-hosted | Every visit's pages, downloads, outlinks, searches, events, goals and orders | An auth token, the address and the site id |
| Plausible | Daily totals, visitors and page views by page, source, country and device, and goal conversions | A Stats API key and the site's domain |
| Pendo | Page views, feature clicks and track events, from its hourly counts | An integration key |
Each tool's own names for a page view, a screen, a purchase, a sign up and the rest become Mode's, so reports read the past and the present the same way, and anything else keeps its name. Every event carries $imported_from and is keyed by the tool's own id, so a day read twice is counted once. An import resumes where it stood after any stop, and its status says the day it is on. Plausible keeps no visitor or event, only totals, so its past comes in as daily metric points and never as people. Pendo keeps counts per visitor and hour, so a count of three page views becomes three page views in that hour.
Your database's rows
Signups, orders and plan changes are already rows in your Postgres or MySQL. Map a table once and each new or changed row is an event, with no code.
- Make a read only role and give Mode its password, the host and the database
- Ask an agent to suggest the mappings, or map each table yourself, users inserted as
$signed_up, orders as$purchase, a subscription's status changed as$subscription_changed - On Postgres, run the setup the suggestion gives, a publication of the mapped tables and replication for the role
CREATE ROLE mode_reader WITH LOGIN REPLICATION PASSWORD 'choose-a-password'; GRANT SELECT ON public.users, public.orders, public.subscriptions TO mode_reader; CREATE PUBLICATION mode_events FOR TABLE public.users, public.orders, public.subscriptions; ALTER TABLE public.subscriptions REPLICA IDENTITY FULL;
A site that never names its people to Mode can still have each account joined to its visitor. Give a mapping the email column and the visitor who typed the same address into your site's sign-in form is the person, matched by its SHA-256 with the source's Hashed email setting on, or by the address itself with Email in plain text on. Give it set, such as ["first_name", "last_name"], and those columns become the person's properties, so reports name them. Give it when to read only some rows. {"column": "privacy_accepted_at", "not_null": true} keeps the rows where the column holds something, so only the accounts that accepted your privacy policy reach a person, and {"column": "plan", "in": ["pro", null]} keeps those whose column holds one of the values, a null keeping the rows where it is empty. Map a table's deletes with {"table": "users", "on": "delete", "erase": true} and deleting an account erases from Mode the person its row named through set, with every identifier they have, as a privacy request Mode makes itself and lists with yours. It reads deletes from the replication slot, so it needs replication. More deletes at once than the mapping's limit (erase_hold_rows, 10 unless set, or erase_hold_percent of the people Mode holds, 2 unless set) are held for an owner (Held erasures). A backend that sends its rows to Mode erases the same way with its table's erase setting (Backend rows). After every read the system's page shows how far the replication slot lags, and its owners and admins are emailed when it lags past 256 MB or nears the database's cap on kept log.
On Postgres Mode reads the changes through a replication slot it makes itself, so every insert, update and delete is seen, with the value before a change where the table's replica identity is full. Mode moves the slot past what it read only after the events were stored. Disconnecting the system drops the slot, so your database keeps no log for a reader that is gone. MySQL, and Postgres without replication, are read by a column that only grows (the primary key, or updated_at for changes), from the table's newest row unless a mapping asks for its whole past.
Only the columns a mapping names are kept, and the person is named by the column you choose, such as the user's id. A row inserted is keyed by its table and its id, so a row is told once however often it is read. Each event carries source database, its table and the mapping's version.
Your database's tables, to query
Keep a table current in Mode and build insights, dashboards and reports on it like any other data. Plays broken down by a movie's genre, signups filtered to a plan's tier, revenue by a product's category.
- Add the table to the system's
query_tables, with its key, the columns to keep and each one's type (text,number,integer,timeorbool), or ask an agent to suggest them - Name
joins, the event column or property that holds a row's key, such asentity_id,distinct_idorproperties.movie_id - Add the table to the publication. Mode copies it once, then keeps it current from the same slot
{"query_tables": [{"table": "movies", "key": "id", "joins": "entity_id",
"columns": {"title": "text", "genre": "text", "year": "integer", "minutes": "number"}}]}Every insight, funnel, retention and report filters, breaks down and sums by rows.movies.genre, the value of the row whose key the event holds. SQL reads the table by its name, with its columns typed, and joins it to events, sessions and the rest of the store.
SELECT m.genre, count() AS plays FROM events e JOIN movies m ON m.key = e.entity_id WHERE e.event = '$media_play' GROUP BY m.genre
Only the columns you map are kept. An update replaces the row and a delete removes it, each in the order your database committed them, so a change made while the copy ran is never lost. Change a table's mapping and Mode copies it again, take it out and its rows are deleted, and disconnecting the system deletes them all. Give a table when, such as {"column": "kind", "in": ["still_watching", "search"]}, and only the rows whose text or integer column holds one of up to 100 values are copied. The rest never reach Mode, and a row that stops matching leaves the table. Polling, on MySQL or without replication, reads a table in the order of its cursor (its key unless set, updated_at to see changed rows) and sees no deletes. A table read here is in the event store, so one statement joins it to events but not to a warehouse table. A table whose rows are named by several columns together, a reminder by its person and series, takes them as a list, "key": ["user_id", "playlist_id"].
Your backend's rows
Your backend sends the changes of its own tables to Mode, in any language. Mode never reads your database, and you choose every table and column that leaves.
- Open Metrics, then Systems, and connect Backend rows. Copy its key, shown this once, and its address
- Send each insert, update and delete to the address with the key, up to 1,000 rows a request
- Mark as sent only the outbox ids the answer accepts, and keep each rejected row with its reason
curl https://$MODE_HOST/v1/systems/$SYSTEM_ID/rows \
-H "Authorization: Bearer $MODE_SYSTEM_KEY" \
-d '{"rows": [{"outbox_id": 41, "table": "orders", "key": 7, "op": "update",
"committed_at": "2026-11-18T10:00:00.123456Z", "sequence": 9,
"columns": {"status": "paid", "total": 12.5}}]}'Each row names outbox_id (your id of the change, so a retry is stored once), table, key (a list for a key of several columns), op, committed_at, sequence (the table's own order of changes) and columns, with schema_version when your columns change. The newest change of a row stands whatever order the rows arrive in, and a delete removes the row. A column whose name looks like a secret, a password, a hash, a token or an API key, is dropped even when you send it, and the answer names it.
With the Python SDK nothing is written by hand. Triggers copy every insert, update and delete of the tables you choose into an outbox table in your own database, in the same transaction as the change, so a change made by hand in SQL is sent too. A sender in your app sends the outbox in batches of up to 1,000 rows, never faster than 10,000 rows a second, and waits with backoff while Mode or the network is down, so your app is never slowed or broken and nothing is lost across restarts. Rows Mode rejects move to mode_outbox_dead with the reason. If Mode takes no rows for a day, or for two minutes with more than 1,000,000 rows waiting, the link pauses. It drops its triggers so your writes cost nothing extra and empties the outbox. Once Mode answers again, the pause is sent to Mode and to your app's report hook, the triggers come back and each linked table is compared with Mode's copy, so only the rows that changed, were added or were deleted during the pause are sent and each row in Mode matches yours. The first copy and backfill, run with MODE_LINK_URL and MODE_LINK_KEY set, compare the same way. Rows resent after a pause Mode caused are free. A trigger whose outbox write fails still lets your own write go through on Postgres and MySQL, and on SQL Server for errors that end only the statement, never on SQLite. Postgres, MySQL and MariaDB, SQLite and SQL Server are supported.
Once a day, with the outbox empty, the sender counts each linked table and sends the counts. Mode compares each with its own copy, allowing one row for every change that arrived after the count, and Data health tells your owners and admins when a table differs or the counts stop for two days.
Your app installs the sender and the one package for its database, and nothing else, not the event client, other databases or the setup commands. Pin both in the file your image installs from, so a running app never needs gotmode.com.
mode-metrics-link @ https://gotmode.com/sdk/python/mode-metrics-link/0.1.2/mode_metrics_link-0.1.2-py3-none-any.whl#sha256=6bced2e408dca8f707fb25dd9331c2999cad98e3bce65e5103392349ef8fb701 mode-metrics-link-postgres @ https://gotmode.com/sdk/python/mode-metrics-link-postgres/0.1.2/mode_metrics_link_postgres-0.1.2-py3-none-any.whl#sha256=9165271f05b05f5a3d046baa78b285f0c5a70cae690a7367c0f37beedea63168
| Package | For | Version | SHA-256 |
|---|---|---|---|
mode-metrics-link | The sender or the scheduled sync your app runs. Every app with a link | 0.1.2 | 6bced2e408dca8f707fb25dd9331c2999cad98e3bce65e5103392349ef8fb701 |
mode-metrics-link-postgres | PostgreSQL | 0.1.2 | 9165271f05b05f5a3d046baa78b285f0c5a70cae690a7367c0f37beedea63168 |
mode-metrics-link-mysql | MySQL and MariaDB | 0.1.2 | f8524ed76588351482ce31e758308dbef9e761f8c29783f148ae8a4eae7564b6 |
mode-metrics-link-sqlite | SQLite | 0.1.2 | 6be0e7c3fa6f0ae13f44c216fe59a16b5b33b8f4122bd066e4b12f757682c945 |
mode-metrics-link-sqlserver | SQL Server | 0.1.2 | 615d7180902f2bfc99788200c61326f1de0ff38e12215d4d9a761d43fa6b6adb |
mode-metrics-link-setup | The setup commands, where you write the migration. Not needed by the running app | 0.1.2 | 7a64109e7a6cbb93248d416c63a5cbdc158680589267b9274f55cb16148d60ea |
Where you write migrations, add mode-metrics-link-setup and run its commands.
pip install --index-url https://gotmode.com/sdk/python/simple/ mode-metrics-link-setup mode-metrics-link-postgres mode-link init --database "$DATABASE_URL" --format alembic --out migrations/versions mode-link backfill --database "$DATABASE_URL"
from mode_metrics_link import Link, load link = Link(os.environ["MODE_LINK_URL"], os.environ["MODE_LINK_KEY"], engine, load("mode-link.json")).start()
init reads your schema, asks which tables and columns leave (never a column that looks like a secret) and writes mode-link.json and a normal migration for SQL, Alembic or Django, so the setup is reviewed like any other change. An app with no migration tool calls mode_metrics_link.install(engine, tables) at start instead. backfill sends every row once, as of the moment the link was installed, so any later change wins. A table can send a personal column only on rows where a consent column is set, or send a column as its SHA-256 or as the host of an address. Once a day, with the outbox empty, the sender sends each table's row count as the table mode_link_counts.
On a schedule, with no triggers. An app that can wait for its changes, an hour say, uses Sync instead. It needs no migration, trigger, outbox, thread or setup command, writes nothing to your database and adds no work to any write. Each time your scheduler runs it, every table is compared with Mode's copy and only the rows that are new, changed or deleted are sent, in batches of up to 1,000, so a table that did not change costs one read and one request. A request Mode does not answer is tried five times, then the run stops and the next one sends what is still missing. The first run of each UTC day also sends the row counts. uninstall(engine) drops the triggers and outbox an earlier Link made.
from mode_metrics_link import Sync, Table tables = [Table("orders", key="id", columns=["id", "status", "total"])] sync = Sync(os.environ["MODE_LINK_URL"], os.environ["MODE_LINK_KEY"], engine, tables) scheduler.add_job(sync.run, "cron", minute=40)
Every table the system sends reads by its name in SQL and as rows.orders.status in every insight, like your database's tables. Name a table's joins in the system's tables setting to read it beside events. Give a table whose key is the person's distinct id, such as your accounts table, erase, {"tables": {"accounts": {"erase": true}}}, and every row deleted from it, by a trigger or by a diff, erases from Mode the person of that distinct id within a minute or two, with every identifier they have, their events, recordings, heatmaps, errors and sessions, as a privacy request Mode makes itself and lists with yours, the same erase a database's erase mapping does. An insert or an update never erases anyone, a delete Mode reads again asks for nothing, and a delete of an account Mode never saw erases what Mode holds of its distinct id, if anything. Turned on later, it also erases the people of rows deleted before, as far back as Mode's copy of the table goes. A run of deletes past the table's limit, more than 10 or 2% of its rows, whichever is larger, erases nobody until an owner approves it (Held erasures). Set erase_hold_rows and erase_hold_percent beside erase to change it. A new column is read as soon as it arrives. A column whose type changes reads on under its own name and the new type as total_v2. Linked rows count in Metrics usage as source rows. Disconnecting the system revokes its key and deletes its rows.
Run your system's actions from Mode
Your system can let Mode start something in it, such as one of its background jobs, from a button in a dashboard's table. Mode never holds your system's own powers. It calls one endpoint you add, with a key you give it, and only for the actions your system lists.
- Add
GET <base>/actionsandPOST <base>/actions/<action>to your system, each checkingAuthorization: Bearer <key> - Open Metrics, then Systems, open the system and save its actions address and key. Mode reads the list at once and every 5 minutes after
- In an insight's table, name the system and the column that holds an action id, and each row gets that action's button
{"actions": [
{"id": "poll", "label": "Post now", "running": false},
{"id": "sync", "label": "Sync now", "running": true}
]}Authorization: Bearer <key>
{"by": "[email protected]", "row": {"job": "Facebook poster", "run": "poll"}}
200 {"state": "running", "message": "Poster run started"}Answer within 10 seconds, with running for work you started in the background, done for work you finished, or refused with the reason, such as one that already runs. by is who asked, so your own log records the run the way it records one started from your admin. A refusal, a timeout or a system Mode can't reach shows its reason in the row and in Activity, and is never tried again on its own. The address must be https on a public host.
The table's insight names the buttons in its display, "actions": {"system": "<system id>", "column": "run"}. Each cell of that column holds an action id and shows that action's button with your label, greyed while your list says it runs. A cell whose action your system doesn't list shows its value.
Owners, admins, members and agents run actions, and so does an Admin or Member guest on the project. A Viewer runs them only when a role of your account given to them includes Run an action a connected system offers (systems:actions:run). Every run is an Activity entry with who asked, which action, the answer and how long it took.
AI provider usage
Connect OpenAI usage or Anthropic usage with an admin key and Mode reads what your organization used and spent by model and day, shown on the LLM page.
From the API and agents
Everything on the Systems page is in the HTTP API and the Metrics MCP server too.
| Do | HTTP | MCP tool |
|---|---|---|
| List the systems Mode connects | GET /v1/metrics/systems/available | systems_available |
| List the project's systems | GET /v1/metrics/systems | connected_systems |
| Connect one | POST /v1/metrics/systems | connect_system |
| Change settings or credentials | PATCH /v1/metrics/systems/{id} | set_system |
| Read a sample, storing nothing | POST /v1/metrics/systems/{id}/test | test_system |
| See what it could not read | GET /v1/metrics/systems/{id}/kept | system_kept |
| See its newest events and who each landed on | GET /v1/metrics/systems/{id}/deliveries | system_deliveries |
| Read it again | POST /v1/metrics/systems/{id}/replay | replay_system |
| Read a polled system now, such as a search engine | POST /v1/metrics/systems/{id}/sync | sync_system |
| Get the Connect address a person opens to connect a system through Mode's own app, such as Google Search Console | POST /v1/metrics/systems/connect with system | system_sign_in |
| Disconnect | DELETE /v1/metrics/systems/{id} | disconnect_system |
| See the actions it offers | GET /v1/metrics/systems/{id}/actions | system_actions |
| Give it an actions endpoint | PUT /v1/metrics/systems/{id}/actions | set_system_actions |
| Remove its actions endpoint | DELETE /v1/metrics/systems/{id}/actions | set_system_actions with remove |
| Run one of its actions | POST /v1/metrics/systems/{id}/actions/{action} | run_system_action |
| Send a Backend rows system's changes | POST /v1/systems/{id}/rows on the system's own address, with its own key, see Your backend's rows | |
| List the affiliate network presets | GET /v1/metrics/affiliate-networks/available | affiliate_networks_available |
| List the connected networks | GET /v1/metrics/affiliate-networks | affiliate_networks |
| Connect a network | POST /v1/metrics/affiliate-networks | connect_affiliate_network |
| Disconnect a network | DELETE /v1/metrics/affiliate-networks/{network} | disconnect_affiliate_network |
| List creator codes | GET /v1/metrics/creator-codes | creator_codes |
| Give a code to a creator | POST /v1/metrics/creator-codes | create_creator_code |
| Change a code | PATCH /v1/metrics/creator-codes/{id} | update_creator_code |
| Remove a code | DELETE /v1/metrics/creator-codes/{id} | delete_creator_code |
| Report by creator | GET /v1/metrics/creators/report | creator_report |
| An open pixel for mail sent elsewhere | POST /v1/metrics/systems/email-pixel | email_open_pixel |
The HTTP routes take a secret key that may use the Metrics MCP server, sent as Authorization: Bearer, and answer exactly as the tools do.