Install the package
npm install web-analytics-reporter
Use the generic runner
runDailySummary() is the portable API. It works anywhere Node.js can run and does not depend on Vercel.
const {
runDailySummary,
ga4Source,
telegramDestination
} = require("web-analytics-reporter");
async function main() {
await runDailySummary({
source: ga4Source({
clientEmail: process.env.GOOGLE_CLIENT_EMAIL,
privateKey: process.env.GOOGLE_PRIVATE_KEY
}),
destination: telegramDestination({
botToken: process.env.TELEGRAM_BOT_TOKEN
}),
sites: [
{
id: "app",
name: "App Website",
ga4PropertyId: process.env.GA4_PROPERTY_ID,
telegramChatId: process.env.TELEGRAM_CHAT_ID
}
],
timeZone: "UTC"
});
}
main();
Where to run it
For a VPS, run the script from system cron. For a backend, expose an authenticated Express route. For platforms, use Railway cron, Netlify scheduled functions, Vercel Cron, or GitHub Actions.
If the report endpoint is public, protect it with a long random secret and call it only from your scheduler.