When installing Chameleon, there are two components that need to be implemented: 

  1. The Chameleon code snippet (to load the builder and Experiences).
  2. The Identify method (to identify users).

We ask developers to identify users by their database ID. This stable identifier ensures that a user sees tours consistently (for example, resuming on the correct step if they leave and return).

For users that don't have a logged-in identity (e.g. visitors), we recommend generating a unique ID and storing it to a cookie, from which it will be read afterward. This can be achieved, for example, by using the following code between the Chameleon code snippet and the Chameleon identify method. 

/* chmln code snippet */

if(user is not logged-in) { var uid;
  try { uid = document.cookie.match(/\bvisitor-uid=([a-z0-9-]+)(;|$)/)[1]; } catch(e) {
    document.cookie = 'visitor-uid='+(uid = Math.random().toString(36).substring(2))+'; expires=Tue, Oct 13 2037 04:24:07 UTC; path=/;';

  chmln.identify(uid, { visitor: true });

/* normal chmln.identify with user.id */

Did this answer your question?