Skip to main content

Tags

Use the setTags() method to change the set of tags.

Tag limitations:

  1. Maximum 100 tags.
  2. Maximum tag length is 50 characters.
  3. Each tag must match the tag format below.

Tag format

Each tag must match the following regular expression:

const regExp = /^[\p{L}_\d][\p{L}_\d\-]{0,49}$/u;
  • The first character must be a letter (any language), digit, or _.
  • Subsequent characters may be letters, digits, _, or -.
  • Total length: from 1 to 50 characters.

Valid tags:

TagWhy it is valid
premiumStarts with a letter; only allowed characters
user_123Letters, digits, and _
en-USHyphen in the middle is allowed
_internalMay start with _
123tagMay start with a digit

Invalid tags:

TagWhy it is invalid
-premiumMust not start with -
user nameSpaces are not allowed
tag.name. is not allowed
tag@emailSpecial characters are not allowed
""Empty string is not allowed

Example

<div id="stories_widget"></div>
import { AppearanceManager, InAppStoryManager } from "@inappstory/js-sdk";

const inAppStoryManager = new InAppStoryManager({ apiKey: "{projectToken}" });
const appearanceManager = new AppearanceManager();
const storiesList = new inAppStoryManager.StoriesList(
"#stories_widget",
appearanceManager
);

inAppStoryManager.setTags(["tag1", "tag2", "tagN"]);

// Reload stories after tags changed (Optional)
storiesList.reload();

Exceptions

When calling setTags() or passing tags during InAppStoryManager initialization, the following errors may be thrown:

IasTagsCountError

Thrown when the number of tags exceeds the limit of 100.

IasTagsLengthError

Thrown when a tag exceeds the maximum length of 50 characters.