Guides / SaaS
Product-led growth is about self-serve conversion. The events that matter are:
// Tracked when user logs their first event successfully
async function trackFirstEvent(userId: string, projectId: string) {
await logit.now("activation", {
event: "First event logged",
description: "User hit their aha moment",
icon: "🎯",
notify: true,
tags: { milestone: "activation" },
metadata: { userId, projectId, activatedAt: new Date().toISOString() },
});
}
async function trackMilestone(userId: string, milestone: string, count: number) {
const milestones: Record<string, { icon: string; notify: boolean }> = {
"5_events": { icon: "⭐", notify: false },
"first_team_invite": { icon: "👥", notify: true },
"100_events": { icon: "🏆", notify: true },
"first_channel_created": { icon: "📢", notify: false },
};
const config = milestones[milestone];
if (!config) return;
await logit.now("milestones", {
event: `Milestone: ${milestone.replace(/_/g, " ")}`,
description: `User reached ${count} ${milestone}`,
icon: config.icon,
notify: config.notify,
metadata: { userId, milestone, count },
});
}
// When user hits a usage limit or clicks "Upgrade"
async function trackUpgradeIntent(
userId: string,
trigger: "usage_limit" | "feature_gate" | "upgrade_button" | "pricing_page"
) {
await logit.now("upgrade-intent", {
event: "Upgrade intent signal",
description: `Triggered by: ${trigger}`,
icon: "⬆️",
notify: true,
tags: { trigger },
metadata: { userId, trigger, url: typeof window !== "undefined" ? window.location.href : "" },
});
}
Watch your activation and upgrade-intent channels daily. If activation drops, your onboarding broke. If intent spikes but conversions don't, your pricing page has a problem.
Try LogIt free
7-day trial. No credit card required.