Skip to content

PostHog/semver-flattener-plugin

Repository files navigation

PostHog Plugin: SemVer Flattener

License: MIT

It is common to want to compare versions when filtering in insights.

Show me events where app_version < 22.7

It isn't possible to (correctly) use string comparison for this because then several comparisons don't work. Amusingly apples < banana but apples > BANANA. Importantly 22.7 is less than 22.7-beta which would be wrong.

This plugin splits a valid SemVer version string into

export interface VersionParts {
    major: number
    minor: number
    patch?: number
    preRelease?: string
    build?: string
}

And flattens them onto an event.

So this...

{
    properties: {
        app_version: '22.7.11'
    }
}

becomes...

{
    properties: {
        app_version: '22.7.11'
        app_version__major: 22,
        app_version__minor: 7,
        app_version__patch: 11
    }
}

Questions?

We're here to help you with anything PostHog!

logo taken from

https://publicdomainvectors.org/en/free-clipart/Decimal-separator-to-the-left/88496.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published