Next.js SDK
v1.0.0The easiest way to integrate Retake into your Next.js app. Includes hooks for everything.
Installation
1. Create Server Route
RequiredCreate a file at app/api/retake/route.ts to handle secure communication.
2. Add Provider
Add this to your root layout so the hooks work everywhere.
3. Track Activity
SaaS: Track Interest
Track when users view your pricing page or start checkout.
Shop: Track Cart
Automatically tracks cart changes. We handle the saving logic for you.
4. Checkout & Conversion
Redirect to Payment
Track the "Checkout" event right before you send them to Stripe.
Success Page
Use useConversionTracking on your thank you page to stop emails.
5. Auto Recovery (The Magic Part)
When a user clicks "Recover Session" in their email, we handle the rest. Just use this hook to get the data back.
Available Hooks
useIntentTracking()The universal hook. Use this to track anything (Pricing view, Upgrade click, etc).
useCartTracking()Specialized for shopping carts. Just pass it your items array and we do the rest.
useConversionTracking()Helper hook to trigger a conversion event on component mount.
useAutoRecovery()Detects when a user is returning from a recovery email and gives you their data.