setItemTags - Methods - Author API

Author API Methods

setItemTags()

Set the list of Tags to associate with the Item being edited. This overwrites the current list of associated Tags. Tags are used in Learnosity authoring to make Items and Activities more contextualized and easily searchable.

You would want to use this method so that you can apply tags to report on learner performance on a set of Items or Activities, for example.

Important Any Tags that do not exist will be created when using this method. Ensure that all Tags are spelled and referenced correctly before calling this method.

Examples

var updatedTags = authorApp.setItemTags(
    [
        { "type": "Grade", "name": "Grade 7" },
        { "type": "Grade", "name": "Grade 8" },
        // ...
    ]
);
console.log(updatedTags);

Arguments

  • tags array[tagsV2]

    An array of TagsV2 objects.

Return value

Type boolean

Returns true if successful.

Returns false if unable to set the Item Tags, for example, when not in the Item editor view, the passed tags is invalid or the same as the current Tags.

Caveats

The hide_tags intialization option has no effect on this method. Hidden tags will be returned by this method if they were specified in the arguments.

Type definitions

  • tagsV2 object

    Tags are used to improve searching for content while authoring and for reporting and analytics purposes.

    See Understanding Tag Formats for Content Creation and Filtering for more information.

    • name string

      The Tag name.

      Maximum length is 255 characters.

    • type string

      The Tag type.

      Maximum length is 255 characters.

Related articles

  • The getItemTags() method, which allows you to get the tags for the Item.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.