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(workers): posthog env vars and additional events capture #2466

Merged
merged 12 commits into from
Jul 12, 2023

Conversation

poolsar42
Copy link
Collaborator

Description

Modifies middleware to keep track of all routes in workers

Testing

Tested normal behaviour of all apps and then checked all captured events in posthog dashboard

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 Jul 11, 2023
@poolsar42 poolsar42 marked this pull request as ready for review July 11, 2023 21:23
szkl
szkl previously approved these changes Jul 11, 2023
@poolsar42 poolsar42 changed the title feat(workers): posthog routes tracker feat(workers): posthog env vars and additional events capture Jul 11, 2023
apiKey: ctx.SECRET_POSTHOG_API_KEY,
properties: { client_id: input.clientId },
})
} else if (typeof prevPublished !== 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be simplified to else if (appDetails.published) and remove line 35

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if it's not set it'll be underfined which return false in if, so I'll keep it as else is (typeof appDetails.published !== "undefined")

*/
await posthogCall({
distinctId: ctx.accountURN as string,
eventName: 'app_unpublished',
Copy link
Contributor

Choose a reason for hiding this comment

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

Set this in a variable from the if check above, and then make the call using the value of the variable. This way we remove one of the posthostCall blocks as apart from the eventName, the other props are exactly the same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@betimshahini betimshahini merged commit cbe6ef5 into main Jul 12, 2023
12 checks passed
@betimshahini betimshahini deleted the feat/platform-telemetry branch July 12, 2023 18:26
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