If you are about to create your user segmentation, we recommend you to use custom data attributes. You can pass any user information within a custom attribute. Compared to tags, attributes provide some more flexibility and more data types. Find out in these articles how to handle Segmentation using attributes and how to implement attributes into your code. However, if you still want to use tags for defining user groups, you can implement the following commands to tag and to untag users. 

How it works 

1. Dev task: Implement your tags

A tag can be any string. However, we recommend limiting the length to 128 characters. You can use the following tag commands

// Tag Command
Userlane('tag', 'admin');

// Multiple Tags Command
Userlane('tag', 'admin', 'exampleTag', 'anotherOne');

// Multiple Tags Command with user identification
Userlane('tag', <user_ID>, ['tag1', 'tag2', 'moreTag']);

// Remove Tags Command
Userlane('untag', 'myCustomTag');

// Remove Multiple Tags Command
Userlane('untag', 'myCustomTag', 'exampleTag', 'anotherOne');

// identify the current user
Userlane('user', 'user_ID');

Positioning and page reloads

  • Set all segmentation commands before you initialize Userlane with Userlane ('init', yourPropertyId);. The 'init' command only needs to be called once in your snippet after all segmentation commands in order to confirm the changes. In this way, Userlane will automatically adjust the assistant to reflect changes in the tags and in the segmentation. It is not necessary to call the 'init' command after each individual segmentation command.

  • The tags are not persistent across page reloads. On every page reload, the user starts with empty tags. This means you have to call the tag or untag command(s) after every page reload.

2. Manager Task: Create and apply your segmentation in the Userlane Dashboard

Follow this userlane to create a User Segment with the implemented tags and this tour to apply the User Segment to a specific chapter/userlane.

Do you need more information?

Contact us via our contact form.

Did this answer your question?