// In contexts/AuthContext.tsx — after login and logout
// (import useAnalytics at the top, then inside the provider):

// After setUser() in login:
posthog.identify(userData.id);
posthog.capture(ANALYTICS_EVENTS.LOGIN_COMPLETED);

// At the start of logout:
posthog.capture(ANALYTICS_EVENTS.LOGOUT);
posthog.reset();

// In app/(auth)/(tabs)/post.tsx — listing creation funnel
const { capture } = useAnalytics();

// When the screen mounts (user started the flow):
useEffect(() => {
  capture(ANALYTICS_EVENTS.LISTING_CREATE_STARTED);
}, []);

// After successful submission:
capture(ANALYTICS_EVENTS.LISTING_CREATE_COMPLETED, {
  categoryId:  data.categoryId,
  photoCount:  photoUris.length,
  priceIsZero: data.price === 0,
  // Note: do NOT include the title, description, or price amount.
  // Metadata (count, boolean) is fine; user content is not.
});

// In components/ListingBoostButton.tsx — boost funnel
// When the button renders (user sees the offer):
useEffect(() => {
  if (product) capture(ANALYTICS_EVENTS.LISTING_BOOST_VIEWED, {
    listingId: listing.id,
    priceString: product.priceString,
  });
}, [product]);

// After a purchase:
capture(ANALYTICS_EVENTS.LISTING_BOOST_PURCHASED, { listingId: listing.id });
// After a cancellation:
capture(ANALYTICS_EVENTS.LISTING_BOOST_CANCELLED, { listingId: listing.id });
