Usetiful tour settings allow you to ensure that one tour is only shown once to each separate user. 

With the addition of User ID feature, this setting is not only relying on users' browser local storage, but Usetiful will also store anonymous information about this users interaction with Usetiful content on our servers. This enables Usetiful to tie User ID received from your application to a certain user when they are signed in, this way guaranteeing that a specific tour will only be shown to a specific user just once. 



TABLE OF CONTENTS


How it works

1. Your application communicates generated user ID in string format to Usetiful, when the user signs in. 

Note: user ID must always be of string data type and must be unique. 

2. Usetiful saves this information on the server - when the user signs in to their account in your application from a different device, Usetiful is still able to recognize this user because the user ID is communicated upon sign in. 

3. All progress in tours and other interaction is tied to this User ID on Usetiful servers - so that when this user signs in to your application and Usetiful is informed about this, they can continue their progress in a specific tour as their progress has been saved automatically before on the server, or they are not shown tours which they have already seen. 



Here's a diagram that explains how it works






The Usetiful script consists of two parts:


<!-- User segmentation start -->

This part is responsible for the segmentation and personalization of the service to anonymous users. It is used for the identification of unique logged-in users.

See how Tags are used for segmentation and personalization.

<!-- User segmentation end -->


<!-- Usetiful script start -->

This part is responsible for the experience layer, interaction with the site, and reporting on user behavior. It uses the variables set up in the previous part.

<!-- Usetiful script end -->


To enable Usetiful recognizing users across multiple devices we will need to provide a unique user ID whenever the Usetiful script is loaded on-page. This is done by customizing the first part of the script.


We introduce a new variable (tag) with the name "userId" into the array usetifulTags. The content of this variable needs to be a unique ID of the logged-in user. If no userID is provided, Usetiful will rely on the browser's local storage contents to serve the content.



How to implement


Overview

Communicating the User ID to Usetiful happens via the Usetiful script on the page. 

Here's a sample script for reference


<!-- User segmentation start -->
<script>
window.usetifulTags = { userId : "xxxxx",     
};</script>
<!-- User segmentation end -->
<!-- Usetiful script start -->
<script>
  (function (w, d, s) {
    var a = d.getElementsByTagName('head')[0];
    var r = d.createElement('script');
    r.async = 1;
    r.src = s;
    r.setAttribute('id', 'usetifulScript');
    r.dataset.token = "exampletoken";
            a.appendChild(r);
  })(window, document, "https://www.usetiful.com/ex/usetiful.js");
</script>
<!-- Usetiful script end -->

You can see that User segmentation section contains a userId parameter with an associated value. This value must be programmatically set by your application in order for cross-device user recognition to work. 

Make sure your application sends a unique user ID for every separate user. 


Steps to implement

1. Add the Usetiful script containing the segmentation part with userId to all the pages where Usetiful content should be shown

2. Setup your application to programmatically place user ID in the segmentation part of the script on the page for each user. 

3. In the settings of your tour, make sure to set "Show to each user just once" to ON. 


Troubleshooting and FAQ


1. If the same ID is communicated for two separated users, Usetiful will not be able to distinguish between them, and the data for two users will be merged into one. This will lead to issues ensuring tours are shown just once. 

2. If user ID is not communicated, Usetiful will rely on local storage to track user interaction with tours. This is not a fail-safe way and can not guarantee that a tour will be shown just once. However, it may potentially work in most cases.