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

Custom aggregation for Mixpanel metrics #278

Merged
merged 7 commits into from
Mar 5, 2022
Merged

Conversation

jdorn
Copy link
Member

@jdorn jdorn commented Mar 4, 2022

For count, revenue, and duration metrics in Mixpanel, the aggregation method is currently hard-coded as a sum. This PR allows users to override this default behavior.

The default behavior remains the same (sum the values): values.reduce((sum,n) => sum+n, 0)

Now you can do something like COUNT DISTINCT: new Set(values).size

Or MAX: Math.max(...values)

Or anything else you want to do.

This PR also makes the event value more flexible. Before, you could only specify properties, now you can specify entire javascript expressions. For example: event.properties.end - event.properties.start or Math.pow(event.properties.x, 2)

@vercel
Copy link

vercel bot commented Mar 4, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/growthbook/docs/Dc1JGQhKK5GJdY1TrTJuxBJ737Ru
✅ Preview: https://docs-git-mixpanel-count-distinct-growthbook.vercel.app

[Deployment for 0fbf8f1 canceled]

@jdorn jdorn changed the title Count Distinct support for Mixpanel count metrics Custom aggregation for Mixpanel metrics Mar 4, 2022
@jdorn jdorn merged commit c91026b into main Mar 5, 2022
@jdorn jdorn deleted the mixpanel-count-distinct branch March 5, 2022 06:34
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.

None yet

1 participant