How to segment users based on subscription plan in Tggl?

If you're looking to tailor feature releases to specific plan tiers, Tggl offers a straightforward way to segment your users based on their subscription plan. Follow these steps to set it up:

  1. Navigate to the “Context” tab in your Tggl dashboard.
  2. Click on “+New” to start setting up a new property.
    • Assign a name to your property, such as “Plan”.
    • Choose the value type for this context property. Set it to “select” to allow multiple options.
Tip

It’s crucial to list all available plan tiers under the options for this context. This ensures that each plan you offer is represented and can be used for segmentation.

  1. Ensure that the context key and the value options you’ve created match precisely with those defined in your application's code. This alignment is necessary for the feature to function correctly.

    For instance, the context key is utilized within your app's code to specify the user's plan:

     await client.setContext({
       plan: 'Premium', // Replace with the appropriate plan name.
     })

In this code example, “Premium” represents the user's subscription plan. You should replace this with the actual plan name or a variable that dynamically represents the user's current plan.

  1. With the context property set up, you can now utilize it to enable features for specific plan tiers. Simply select the “Plan” context property when creating or editing feature flags. This allows you to specify which user segments, based on their plan, will have access to these features.