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
// Multiple Tags Command
Userlane('tag', 'admin', 'exampleTag', 'anotherOne');
// Remove Tags Command
// Remove Multiple Tags Command
Userlane('untag', 'myCustomTag', 'exampleTag', 'anotherOne');
// identify the current user
Positioning and page reloads
- Set all segmentation commands before you initialize Userlane with Userlane ('init', yourPropertyId);. Call the init command after any changes in the tag segmentation in order to confirm those changes. This way, Userlane will automatically adjust the assistant to reflect changes in the tags and in the segmentation.
- 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.
- How to segment your userlanes / chapters based on users
- Best practices: Create a Solid Segmentation Concept
- How to create custom attributes
- How to implement custom attributes into your code
Do you need more information?
Contact us via our Intercom Chat or email@example.com.