Skip to content

Configuração usuários ativos iOS#485

Draft
lui7henrique wants to merge 1 commit intomainfrom
cursor/configura-o-usu-rios-ativos-ios-073c
Draft

Configuração usuários ativos iOS#485
lui7henrique wants to merge 1 commit intomainfrom
cursor/configura-o-usu-rios-ativos-ios-073c

Conversation

@lui7henrique
Copy link
Member

Describe your changes

This PR addresses issues preventing accurate active user tracking for the iOS app in PostHog.

Key changes include:

  • Enhanced Event Properties: Added $lib, $platform, $device_type, and $lib_version to all analytics events to ensure proper segmentation and filtering in PostHog.
  • Correct User Merging: Modified the identify call to include $anon_distinct_id, ensuring anonymous user activity is correctly merged with identified user profiles upon login.
  • Robust API Key Handling: Implemented a fallback mechanism in Environment.swift and added validation in AnalyticsService.swift to handle cases where the POSTHOG_API_KEY build variable might not be correctly substituted, preventing events from being rejected.
  • Profile Properties: Included $platform and $lib in user profile properties during identify for better user segmentation.

These changes ensure that iOS active users are correctly counted and attributed in PostHog dashboards.

Issue ticket number and link

N/A

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it's an essential feature, I've tested it thoroughly.
  • Do we need to implement analytics?
  • Will this be part of a product update? If yes, please write one phrase about this update.

Open in Web Open in Cursor 

- Add $lib, $platform, $device_type to all events so PostHog can segment iOS users
- Add $anon_distinct_id to identify call for proper merge of anonymous → identified users
- Add $platform and $lib to person properties on identify for dashboard filtering
- Fallback to default PostHog key when build variable is not substituted (xcconfig)
- Guard against unsubstituted $(VAR) values in analytics payload sends

Co-authored-by: Luiz Henrique <7henrique18@gmail.com>
@cursor
Copy link

cursor bot commented Feb 22, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Feb 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plotwist Ready Ready Preview, Comment Feb 22, 2026 4:46pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants