Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(analytics): track metrics for apps and groups as for users #2627

Merged
merged 14 commits into from
Aug 22, 2023

Conversation

poolsar42
Copy link
Collaborator

Description

Creates tracking for groups' and apps' events for future metrics.

Related Issues

Testing

All events were tested locally.

Checklist

  • I have read the CONTRIBUTING guidelines
  • I have tested my code (manually and/or automated if applicable)
  • I have updated the documentation (if necessary)

@poolsar42 poolsar42 self-assigned this Aug 21, 2023
@poolsar42 poolsar42 force-pushed the feat/2608-metrics-for-apps-and-groups branch from e074a40 to 3273c58 Compare August 21, 2023 16:58
@poolsar42 poolsar42 marked this pull request as ready for review August 21, 2023 20:00
platform/account/src/jsonrpc/methods/resolveIdentity.ts Outdated Show resolved Hide resolved
platform/account/src/jsonrpc/methods/resolveIdentity.ts Outdated Show resolved Hide resolved
platform/authorization/src/jsonrpc/methods/authorize.ts Outdated Show resolved Hide resolved
distinctId: ctx.identityURN as IdentityURN,
eventName: input.published ? 'user_published_app' : 'user_unpublished_app',
apiKey: ctx.POSTHOG_API_KEY,
properties: { $groups: { app: input.clientId } },
Copy link
Contributor

Choose a reason for hiding this comment

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

example of where we need to add gropu id later

apiKey: ctx.POSTHOG_API_KEY,
distinctId: identityURN,
properties: {
$groups: { app: clientId },
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add plan type or sometning here, do we have it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here is where we update property of the app. I set plan as a property of the app - this way it's easier to filter apps on paid and free ones.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right now the only way to change group is through calling $groupidentify event. This event is called when I need to identify a group to show it under Persons & Groups tab and also to set its properties (in fact something must be in properties for the group to show up).


// This is the way how we can update group properties
// https://posthog.com/tutorials/frontend-vs-backend-group-analytics
await createAnalyticsEvent({
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the different between these two types of events?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Per our convo in discord, it sets app properties to the group.

apps/console/app/routes/__layout/billing/webhook.tsx Outdated Show resolved Hide resolved
apps/passport/app/routes/settings/advanced.tsx Outdated Show resolved Hide resolved
@maurerbot maurerbot merged commit 71aca00 into main Aug 22, 2023
14 checks passed
@maurerbot maurerbot deleted the feat/2608-metrics-for-apps-and-groups branch August 22, 2023 16:52
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.

feat(analytics): track metrics for app as for users
2 participants