When installing Chameleon, there are two components: 

  1. Chameleon code snippet (to load the builder and tours)
  2. Chameleon identify call (for identification of users)

We ask developers 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 to and reading from this cookie.

For example, using the code below between the Chameleon code snippet and the Chameleon identify call. 

/* chmln 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?