Product Benefits Pricing Guides Docs About Contact us Try it out
Analytics tools

PostHog beforeSend Ran Twice: Event Data Check

PostHog Android 3.72.10 fixes beforeSend running twice per event. Learn how to audit event tracking changes to distinctId, timestamp and uuid.

· 3 min read

PostHog’s Android SDK 3.72.10, released on 26 October, fixes a bug in the shared core library (6.47.6) where the beforeSend hook ran twice for each event. Because the second run started from the original event, changes made on the first run to distinctId, timestamp and uuid were thrown away.

Why it matters: beforeSend is where many teams scrub personal data, rename events, drop noisy ones and correct identities. If it quietly runs twice and loses some edits, your event tracking can look fine in code review while sending something different to your analytics project.

What Goes Wrong Without It

A team uses beforeSend to replace a raw account ID with a hashed one in distinctId and to stamp events with a corrected timestamp. After the double run, the hashed ID is lost and the original value is sent. Users appear under two identities, funnels break in the middle, and nobody notices because the hook itself looks correct.

A second risk is side effects. If your hook increments a counter, writes a log line or calls a service, doing it twice per event inflates your own internal numbers.

Data Points to Track

  • sdk_version: the PostHog Android version running on each device, so you can compare before and after 3.72.10
  • before_send_invocations: a local counter per event, to confirm the hook runs once
  • before_send_modified_fields: which of distinctId, timestamp, uuid or properties your hook changes
  • event_name: to see which events your hook renames or drops
  • distinct_id_changed: a boolean for events where the hook replaced the identity
  • duplicate_uuid_count: repeated uuid values received in a day
  • app_version and platform: to separate release effects from SDK effects

Setup Steps

  1. List every beforeSend hook in your Android app and note exactly which fields each one edits.
  2. Add a temporary debug counter inside the hook and confirm how many times it fires for a single captured event on your current SDK version.
  3. Update to PostHog Android 3.72.10 or later and repeat the test. The counter should read one.
  4. Capture a test event while the hook changes distinctId, timestamp and uuid, then check the event in your PostHog live view to confirm the edited values arrived.
  5. Make any side effects in the hook safe to repeat, so a future bug cannot double count them.
  6. Add sdk_version as a super property so you can filter dashboards by SDK release.
  7. Save a saved insight that counts unique distinct_id values per day, and note the release date on it.

Actionable Insights

Look for an identity step change. If unique users or anonymous profiles shift on the day a version rolled out, compare the share of events with edited identities before and after the update.

Check timestamps. If your hook corrects clock skew or backfills offline events, confirm that late events now land on the right day. Daily active user counts for earlier days may differ from what you saw before.

Separate old and new versions. Users on older app builds still send events through the old SDK. Break results down by sdk_version rather than assuming the whole base changed at once.

Treat hooks as code that needs tests. A small unit test that runs the hook against a sample event, and checks the output fields, would have caught this class of problem early.