Daily
Get a morning count of new users and orders
Each morning you see how many documents yesterday added to each collection, next to the day before.
- Runs
- Daily
- Apps
- Firebase
- AI
- Not needed
- Access
- read
Send this to your assistant
Create a ClickRuntime automation: every day at 7am, count the documents created yesterday in my Firestore 'users' and 'orders' collections and email me both numbers with the change from the previous day.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Founders of small apps usually know their numbers only roughly. Someone opens the Firebase console, scrolls a collection, and guesses that signups were up this week. The console does not show how many documents were created yesterday, so tracking growth means writing a script, and the script never gets written. Without a daily figure, a marketing push that doubled signups looks the same as a quiet Tuesday, and a broken checkout that halved orders goes unnoticed for days.
Each morning, ClickRuntime runs aggregation count queries against Firestore for the previous day, one for new users and one for new orders, and emails you the totals with a comparison against earlier days. The counts are made by Firestore itself, so no documents are downloaded.
It is useful for solo founders and small product teams who want a daily pulse without building a dashboard.
What you get out of it
Notice a broken signup flow quickly
If new users drop from sixty to three overnight, the email shows it the next morning. A bug in the registration form is found and fixed in a day instead of lingering through a whole week of lost growth.
Measure what marketing really did
A campaign launch or a mention in a newsletter shows up as a jump in the count. You learn which efforts bring real users and which only bring clicks, and budgets follow the evidence.
Skip building a custom dashboard
A small team can spend a week wiring a dashboard and still end up with a number nobody reads. A morning email with the two figures that matter costs nothing to maintain and gets read daily.
Keep costs low for large collections
Count aggregation is computed inside Firestore and is billed far below the cost of reading every document. Even with a million records, you get yesterday's total without a surprising bill at the month's end.
Build a simple growth record
Saved emails or the stored trend give a running history of daily creation. Investors, partners and your own planning all benefit from being able to say how many orders you had in each week.
How it works
What happens, step by step
Every morning ClickRuntime counts the documents added yesterday to each Firestore collection you chose, such as users and orders.
It compares each count with the day before.
You get an email with the numbers and the change for each collection.
Before it runs live
- Connect Firebase
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Firebase steps into one automation
Under the hood
The code that runs this automation
from datetime import date, timedelta
from clickruntime import on_trigger, credentials, http, notify
PROJECT = "acme-prod"
FS = f"https://firestore.googleapis.com/v1/projects/{PROJECT}/databases/(default)/documents"
def fs_headers():
return {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
def val(field):
return next(iter(field.values())) if field else None
def count(collection, start, end):
filters = [{"fieldFilter": {"field": {"fieldPath": "createdAt"}, "op": op, "value": {"timestampValue": f"{d}T00:00:00Z"}}}
for op, d in (("GREATER_THAN_OR_EQUAL", start), ("LESS_THAN", end))]
body = {"structuredAggregationQuery": {"aggregations": [{"alias": "n", "count": {}}], "structuredQuery": {
"from": [{"collectionId": collection}], "where": {"compositeFilter": {"op": "AND", "filters": filters}}}}}
result = http.post(f"{FS}:runAggregationQuery", json=body, headers=fs_headers()).json()[0]["result"]
return int(result["aggregateFields"]["n"]["integerValue"])
@on_trigger
def run(event):
today = date.today()
y, d2 = today - timedelta(days=1), today - timedelta(days=2)
lines = []
for c in ("users", "orders"):
now, before = count(c, y, today), count(c, d2, y)
lines.append(f"{c}: {now} ({now - before:+d} vs the day before)")
notify.email_me(f"Firestore new documents {y}", "\n".join(lines))
return {"lines": lines}FAQ
Common questions
How does it work out yesterday's documents?
Can I count more than users and orders?
Does it cost much to run each morning?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Export Firestore to Cloud Storage nightly
Your Firestore data is exported to a dated folder each night, and you are told if an export fails.
See how it worksSee yesterday's new sign-ups each morning
A private email lists the accounts created in the last 24 hours, with how each person signed in and the running total.
See how it worksHear about every new Firestore document
A few minutes after a document lands in the collection you pick, you get its key fields in Slack or email.
See how it worksKeep exploring
Set up “Get a morning count of new users and orders” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.