Skip to main content

Tags

Tags allow you to segment and target content dynamically. When tags are set in the SDK, only stories, In-App Messages, onboardings, and banners matching the active tags will be displayed to the user.

Pay attention

There are several limitations on the list of tags that can be passed to the InAppStory SDK:

  1. Allowed characters: tags can only contain letters (any script), digits, underscores (_), and dashes (-);
  2. Maximum count: the total list must not exceed 100 tags.

If a validation rule is violated, an error is logged to console.error and the call is not sent to the native SDK, preventing invalid state without crashing the application.

Setting tags at init​

Pass tags in the config when you create the manager. They apply immediately to all content:

const storyManager = await StoryManager.create({
apiKey: '<your-api-key>',
tags: ['tag1', 'tag2'],
});

Updating tags at runtime​

setTags replaces the whole tag list:

storyManager.setTags(['tag1', 'tag2']);

addTags appends tags to the current list without replacing it:

storyManager.addTags(['tag1']);

removeTags drops specific tags from the current list:

storyManager.removeTags(['tag2']);
tip

Call setTags / addTags before opening a reader or rendering a list — content is filtered by the tags active at load time.