Skip to content

Conversation

@luiskcc
Copy link
Collaborator

@luiskcc luiskcc commented Dec 7, 2025

Track individual app/website block attempts in PostHog

   Added PostHog event tracking to monitor when users attempt to access blocked apps/websites during focus sessions.

   Changes:
   - Added 'app_or_website_block_attempt' event type in analytics.ts
   - Added 'blocked_item_name' property to track specific blocked items
   - Listen to 'on-app-blocked' event in useNotificationListener.ts
   - Extract trackBlockedApps() helper function for cleaner code
   - Use app_external_id for websites (URLs) and app_name for apps
   - Each block attempt fires a separate PostHog event
image

  - New event: 'apps_and_websites_blocked'

  2. Added Analytics Properties (src/lib/analytics.ts:164-170)

  - blocked_apps_count: Number of apps being blocked
  - blocked_websites_count: Number of websites being blocked
  - total_blocked_count: Total count of blocked items
  - is_block_list: Whether it's a block list or allow list
  - blocked_app_names: Array of app names being blocked
  - blocked_website_names: Array of website names being blocked

  3. Created Analytics Data Function (src/api/ebbApi/blockingPreferenceApi.ts:150-187)

  - New function getWorkflowBlockedAppsAnalytics() that:
    - Reuses the same logic as getWorkflowBlockedApps() to get all blocked apps
    - Separates apps from websites based on the is_browser flag
    - Returns detailed analytics data including counts and names

  4. Added Tracking Call (src/pages/FlowPage/FlowPage.tsx:70-79)

  - Tracks the event when blocking starts
  - Includes all the analytics data along with workflow info
  - Only visible on PostHog dashboard for internal analysis

  Now when users start a focus session, you'll be able to see in PostHog:
  - How many apps/websites are being blocked per session
  - Which specific apps/websites are most commonly blocked
  - Whether users prefer block lists vs allow lists
  - Patterns across different workflows
   Added PostHog event tracking to monitor when users attempt to access blocked apps/websites during focus sessions.

   Changes:
   - Added 'app_or_website_block_attempt' event type in analytics.ts
   - Added 'blocked_item_name' property to track specific blocked items
   - Listen to 'on-app-blocked' event in useNotificationListener.ts
   - Extract trackBlockedApps() helper function for cleaner code
   - Use app_external_id for websites (URLs) and app_name for apps
   - Each block attempt fires a separate PostHog event

The monitoring service is a Rust application that runs on your computer and is responsible for recording your activities. It is designed to be run as a background service and will not interfere with your workflow. Makes use of the os-monitor crate to monitor your activities and then record them to the database on your device.

# [Monitor](https://github.com/CodeClimbersIO/os-monitor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accident*

const permissions = licenseData?.permissions || defaultPermissions
// In dev mode, grant all pro permissions
const isDevMode = isDev()
console.log('[usePermissions] isDev:', isDevMode, 'import.meta.env.DEV:', import.meta.env.DEV)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove console logs

? devPermissions
: (licenseData?.permissions || defaultPermissions)

console.log('[usePermissions] permissions:', permissions)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@luiskcc luiskcc merged commit 66b6755 into main Dec 7, 2025
1 check passed
@luiskcc luiskcc deleted the blocked-sites-event-posthog branch December 7, 2025 18:37
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.

3 participants