# User Segments with Storyly

This guide shows you how to show specific story groups using labels.

In Storyly SDK, labels are called segments, and the process is called StorylySegmentation. If you have already set your labels for your story groups from the Storyly Dashboard, then you are ready to go. As it can be seen below, our StorylyInit class StorylyInit has a parameter called segmentation, which has the following definition:

class StorylySegmentation constructor(segments: Set<String>?,
                                      val isDynamicSegmentationEnabled: Boolean = false,
                                      val dynamicSegmentationCallback: StorylyDynamicSegmentationCallback) {}
class StorylySegmentation(Set<String> segments, boolean isDynamicSegmentationEnabled, StorylyDynamicSegmentationCallback dynamicSegmentationCallback) {}
or 
class StorylySegmentation(Set<String> segments, boolean isDynamicSegmentationEnabled) {}
or
class StorylySegmentation(Set<String> segments) {}

In StorylySegmentation class, the segments parameter takes a set of strings that will be used in the process of segmentation to show specific story groups to the users. If a label of the story group in the dashboard is a subset of your segments given to SDK, SDK will show that story group. For basic targeting, it is enough to set the segments parameter.

# Example Usage:

  • If you do not give any parameters to segments, SDK will show all active story groups with/without labels. This is the default behavior.
  • If you set ["car", "man"] to the segments, Storyly SDK will show the story groups whose label set is "car", "man", car" and "man" and lastly, it will show the story groups without labels.
  • If you set an empty value to the segments, only the story groups without labels will be shown.

# Optional Unique Identifier

This section shows you how to send a custom parameter for analytical purposes.

Storyly SDK allows you to send a string parameter in the initialization process. In StorylyInit class, the customParameter field is used for these analytical purposes.

class StorylyInit(storylyId: String, segmentation: StorylySegmentation, customParameter: String?)
class StorylyInit(String storylyId, StorylySegmentation segmentation, String customParameter)

WARNING

You are allowed to send a 200 characters string value with the customParameter field. If you exceed the size limit, your value will be set to null.