Stickybeak Docs Dashboard Get early access

Goals and revenue

Polar

Polar analytics in Stickybeak starts with the checkout ID in your success URL. Verify it on your server, then send the purchase.

Polar.sh revenue tracking

https://example.com/thank-you?checkout_id={CHECKOUT_ID}
import { createPolar } from "@polar-sh/sdk/2026-10";
import { TrackPurchase } from "./track-purchase";

const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN! });

export default async function ThankYou({ searchParams }: { searchParams: Promise<{ checkout_id?: string }> }) {
  const { checkout_id } = await searchParams;
  const checkout = checkout_id ? await polar.checkouts.get(checkout_id) : null;
  const purchase = checkout?.status === "succeeded" && checkout.total_amount > 0
    ? { revenue: checkout.total_amount / 100, currency: checkout.currency, orderId: checkout.id }
    : null;
  return <main><h1>Thanks</h1>{purchase ? <TrackPurchase {...purchase} /> : null}</main>;
}
"use client";
import { useEffect } from "react";
export function TrackPurchase({ revenue, currency, orderId }) {
  useEffect(() => {
    window.stickybeak?.("purchase", { revenue, currency, order_id: orderId });
  }, [revenue, currency, orderId]);
  return null;
}

total_amount is cents including tax; net_amount is after discounts and before tax. The checkout ID is removed from analytics URLs. Hosted checkout returns can become a new referral after 30 minutes; renewals and refunds are not recorded.