t1k:marketing:monetization:cashflow
| Field | Value |
|---|---|
| Module | monetization |
| Version | 1.49.21 |
| Effort | high |
| Tools | — |
How to invoke
Section titled “How to invoke”/t1k:marketing:monetization:cashflowMonetisation Cashflow
Section titled “Monetisation Cashflow”Tracks cash that landed, which is a different question from the one the reporting APIs answer. MAX, AdMob and CloudX report revenue earned. This skill reports revenue received — the wire that cleared, from which legal entity, against which revenue month, and whether it was on time.
The two diverge constantly: a network’s estimate is trued up at payout, terms run from 10 to 71 days, and a month below a partner’s minimum payout is not paid at all but rolls forward. None of that is visible from the earned side.
Executed by
Section titled “Executed by”Mostly judgment-light bookkeeping: the Apps Script and scripts/ tests run the
mechanical steps; the agent only interprets results (routing SSOT:
rules/orchestration-rules.md § “Task-Type → Agent Routing”):
| Step | Agent |
|---|---|
Run scripts/tests/*.mjs and report pass/fail | t1k-tester |
| Tally paid vs due per partner from the ledger the script emits | t1k-metrics-reporter |
| Decide whether a late payment is a real problem or a net-days/minimum artefact | stays on a reasoning tier |
When to use
Section titled “When to use”- “Did AppLovin pay for August?” · “When did we last get money from Mintegral?”
- “Who owes us right now?” · “Is anything overdue?”
- Reconciling a deposit against what a network said it would pay.
- Standing up the same tracking for another studio entity or bank account.
Not for earned-revenue pulls — that is
t1k:marketing:analytics:crawldata (spend + revenue per app per day).
The model
Section titled “The model”Three facts decide everything, and two of them usually live only in a spreadsheet nobody automated:
| net | days after the revenue month ends before payment is due |
| min | minimum payout; a month below it rolls into the next |
| observed lag | how long the partner actually takes, measured from dated payments |
Without net and min, every unpaid month reads as missing. On one real book
that flagged $49,206 across ten partners as outstanding when none of it was
even due, while burying the one partner genuinely late.
Observed beats stated. One partner’s book said net 60; it pays in 18. Using the stated figure would have placed the chase six weeks after the money was actually late. Six of twenty-one partners diverged by more than five days.
No credentials, no Cloud project, no API keys. The deposit path uses only built-in Apps Script services.
- Open the target Google Sheet → Extensions ▸ Apps Script.
- Paste
scripts/appsscript/*.jsas separate script files (Apps Script calls them.gs; they are stored as.jshere so the kit’s origin gate covers them, andclasp pushconverts them). Apps Script puts every.gsin one shared global scope. - Manifest scopes — Apps Script infers these, but declaring them is clearer:
gmail.readonly,script.send_mail,userinfo.email,spreadsheets.currentonly,script.scriptapp. - Run
scanAirwallexDepositsonce. Approve the consent screen. - Run
enableDepositWatchto arm the daily 09:00 trigger.
Nothing runs on its own until step 5. Check the Triggers page to confirm.
The four tabs
Section titled “The four tabs”| Tab | Owner | Contents |
|---|---|---|
Cashflow | script | one row per deposit — date, amount, fee, currency, partner, reference, deposit ID |
By Partner | script | one row per partner — status, last payment, days ago, months paid, total per currency, pays-in, next expected |
Deposit Senders | you | bank remitter substring → partner. A new payer is a row here, never a code change |
Payment History | you | imported ledger: partner × revenue month × amount, with the payment date where known |
How the daily job works
Section titled “How the daily job works”Airwallex emails you → Gmail ↓ 09:00, on its own scanAirwallexDeposits ↓ Cashflow tab · By Partner tab · one-line notificationEach run: searches from:airwallex.com + "You received a deposit of" over the
last 30 days · skips messages already logged by message id · parses the notice ·
attributes the sender · appends · rebuilds By Partner · notifies only if
something new arrived. Silent on quiet days, so a notice that does arrive means
something.
Notification goes to Discord when DISCORD_WEBHOOK_URL is set, and by e-mail
otherwise — a dead webhook falls back to e-mail rather than going quiet. A single
deposit puts the whole line in the subject:
15/09/2026 - +2,468.10 USD - GAMMA NETWORK SOLUTIONS FZ → Yandex · net 60 · min $150Parsing: read the labels, never the prose
Section titled “Parsing: read the labels, never the prose”An Airwallex notice is a sequence of labelled blocks — label alone on its line, value beneath:
Deposit amount Fee From12,345.00 USD 37.04 USD ALPHAADSCORPORATION
Created at Deposit ID Reference2026-09-16 10:36:59 (Asia/Hong_Kong) 652139ad-… INVOICE UI 000001 …Read every field from its label. An earlier version scraped ALL-CAPS runs
instead and, against a real mailbox, attributed 8 of 25 deposits to the
payment narrative — INVOICE UI 000002 VENDOR PAYMENT INSTRUCTED AMT USD 11111.11 — because a long narrative line outscores a short company name.
Consequences worth keeping:
Created atis the deposit date, not the mail’s send time. A notice can arrive the day after the money does; the ledger dates the money.- Match on
Fromalone. The Reference line carries text like… UNITY MONETIZATION PAYMENT …, and matching the whole body attributed aOMICRON PTE. LTDdeposit to Unity. Deposit IDis the real handle — a UUID.Referenceis free text the sender chose: an invoice number,EDI PYMNTS NTE, or just-.Feegets its own column, so what a network says it paid reconciles against what landed.- Gmail’s
subject:operator matches loosely — re-check the subject as a substring in code, or a “Your deposit was reversed” notice logs as cash in. - The sender is matched on the domain (
airwallex.com), because notices come fromsupport@info.airwallex.com. Pinning the exact address found nothing at all, silently. The real address is then re-checked in code so a mail merely displaying the domain in its From name cannot reach a money log.
Attribution is data, not a guess
Section titled “Attribution is data, not a guess”Bank remitters are legal entities (DIGITAL TURBINE (IL) LTD); partner names
are trade names (DT). Neither contains the other, so trade names alone
attributed 8 of 25 real deposits. Deposit Senders maps substring → partner
and KNOWN_REMITTERS seeds the confirmed ones in code so the mapping survives a
rebuilt tab or a second spreadsheet.
Outcomes:
- exactly one partner matched → attributed
- several aliases, all one partner → agreement (names compare case- and
space-insensitively, so
ApplovinandAppLovinare one partner) - zero or two-plus different partners → row is still written, partner blank, Note says why. A deposit that landed must never be invisible because we could not name the payer.
Deposits from senders that are not monetisation partners are classified
(not monetisation) rather than left blank, so they stop reporting as
unfinished work.
Guardrails — the traps that cost real data
Section titled “Guardrails — the traps that cost real data”Each of these was a live bug, not a hypothetical:
- Never double-count. A deposit already in the imported ledger is skipped — matched by date, or by exact amount for the undated rows, which are most of them. The ledger’s dates were read off the very emails the log also holds.
- Re-attribution must never overwrite a hand-set partner on a row whose
Payer is blank. Airwallex omits the sender entirely on some deposits (no
Fromblock, prose reads “received a deposit via your … Account”), so those can only be set by hand — and a rerun would silently un-attribute the money. - Build the summary before the quiet-day exit.
By Partnersummarises the whole log, not the run; gating it on “something new arrived” means it is never built on the normal case — a scan over an already-complete log. - Sheets parses
2024-08as a Date on paste. A reader that tests for the text rejects the entire ledger and silently does nothing. - Status in words, not colour alone —
On track,Overdue 12d,Never paid,Retired. A status has to survive being printed, read by someone colour-blind, or skimmed. Colour reinforces the word on that one cell; filling whole rows buries the numbers. - Gmail reaches back 30 days. Anything older must be imported, not crawled — that window made partners with years of payments read as never having paid.
The dashboard
Section titled “The dashboard”Rendered as a standalone HTML page on the user’s machine: three sections (trend, UA spend, Monet partner grid), the overrides layer and edit persistence are in references/dashboard.md. Never publish the page as a claude.ai Artifact: it holds finance figures, and an Artifact is viewable by anyone it is shared with.
| Path | What |
|---|---|
scripts/appsscript/Cashflow.js | the deposit watcher — parsing, attribution, By Partner |
scripts/appsscript/Payments.js | network payout notices, staged for approval |
scripts/appsscript/MoneyFlow.js | earned-vs-received ledger, per payer per month |
scripts/appsscript/Config.js, Lib.js | credential store and shared helpers |
scripts/appsscript/Crawl.js | the Ad Data menu that reaches every function |
scripts/appsscript/Connectors*.js, Merge.js, Monthly.js | the crawl half of the same project |
scripts/tests/test-*.mjs | Node harnesses stubbing the Apps Script runtime |
scripts/dashboard/build-dashboard.py | the dashboard generator (trend chart, UA spend grid, Monet grid) |
scripts/ua-spend/crawl-month.mjs | monthly UA spend crawler: Mintegral, Google Ads, Unity, AppLovin |
examples/payment-history.example.txt | the ledger import format |
examples/track.example.json | the dataset shape the dashboard consumes |
examples/overrides.example.json | the Monet corrections shape --overrides consumes |
Paste all of scripts/appsscript/, not just Cashflow.js. Apps Script puts
every .gs in one shared global scope, and the deposit watcher calls into
Config.js (CFG), Lib.js (logLine, n, ymd), MoneyFlow.js
(fmtMoney) and Payments.js (distinctPayers). Pasting the one file produces
a project that saves cleanly and then throws on first run.
These files are shared with t1k:marketing:analytics:crawldata — the two skills
are two halves of one Apps Script project, earned and received. Ship them
together; if you only want cashflow, the crawl connectors sit idle and cost
nothing but the paste.
Run the tests with bun scripts/tests/test-cashflow.mjs from scripts/ — they
need no network, no Sheet and no credentials.
Related
Section titled “Related”t1k:marketing:analytics:crawldata— the earned side (spend + revenue per app)t1k:marketing:monetization:mediation-strategy— who the partners arerules/ad-network-mcp-write-safety.md— money-risk guardrail for writes