Segmentation targeting with StorifyMe
In case you want your widget to be dynamic and to show different stories to different audiences you would need to add tags into the script. Once StorifyMe receives the demographic you want to show stories to, it will only show the stories within a widget that match the tags for that demographic.
Setup segments
In the following example we will create a segment for stories with tags
of ["featured", "sport"].
You need to have the working StorifyMe setup as described in Initial SDK Setup
Set your tags in the StorifyMe platform
When publishing story in the StorifyMe platform, you will find an option named "Story tags". There you should set your tags (for example "featured", "sport") and we will only show those stories that have one (or more) of the defined tags.
Set your tags in the StorifyMe SDK
In order to show stories with specific tags, you need to configure them in the SDK itself. You can do that by using the following method:
storiesView.config = StorifyMeWidgetConfig.Builder()
.setSegments(arrayListOf("featured", "sport"))
.build()
Once the widget is loaded, we will show stories with the tags defined in this method.
Set query parameters to any story
In order to send custom query parameters with every story, you can add them in the following way to your storiesView
:
storiesView.config = StorifyMeWidgetConfig.Builder()
.setQueryParameter("key-example-1", "value-example-1")
.setQueryParameter("key-example-2", "value-example-2")
.build()
Set customerId
for User Actions Tracking
To track user actions within the StorifyMe Widget, such as when a user clicks on a poll or performs any other action, you can set the customerId
using the following steps:
storiesView.config = StorifyMeWidgetConfig.Builder()
.setCustomerId("customer-id-example")
.build()
Example usage
- If you do not give any parameters to segments, StorifyMe SDK will show all stories with/without tags that belong to this widget. This is the default behavior.
- If you set tags, StorifyMe SDK will show the stories that have one or more of the defined tags. For example, if you set segments
['featured', 'sport']
, Storifyme SDK will show all stories that belong to this widget and have eitherfeatured
orsport
tag (or have both tags). - If you set an empty value to the segments, only the stories without tags will be shown.
- By setting the
customerId
for user actions tracking, you enable the StorifyMe SDK to capture and provide information about the specific user actions performed within the widget. The customerId can be used to identify the user or correlate their actions with specific events or data in your system.