Documentation

    Identifying the Visitor

    There are several ways to identify the visitor on Co-Browsing API.

    Providing Identity Information

    You can provide identity information when initializing the SDK or update it later.

    At Initialization

    Provide the details with the Upscope('init'); function if you have them from your backend:

    // Rest of the installation code...
    Upscope('init', {
      identities: ['John Smith', 'acme.com'],
      uniqueId: '00032'
    });
    

    After Initialization (SPA)

    Call Upscope('init'); first, then provide the identity information with Upscope('updateConnection');:

    // Rest of the installation code...
    Upscope('init');
    
    // getVisitorInfo is a made up function you might have in your code
    getVisitorInfo().then(visitor => {
      Upscope('updateConnection', {
        identities: [visitor.name],
        uniqueId: visitor.id
      });
    });
    

    Visitor Information Details

    You can provide the following bits of visitor information:

    KeyTypeDescription
    identitiesString[]An array of strings with whatever identifying information you want to send us.
    uniqueIdStringA string with a unique id of the visitor from your database. This could be the visitor's email address.
    tagsString[], each matching /^#[A-Z-]+$/An array of hashtags to filter visitors by.
    integrationIdsString[], each matching /^[a-z]{3,}:.+$/An array of strings representing an integration name and an integration id. For example, if your app is called acmechat, and the acmechat ID for the visitor is 123, you could pass ["acmechat:123"].
    metadataObject/DictionaryCustom key-value pairs for additional visitor data.

    Removing Identification

    Any piece of identification set to undefined (web) or nil/null (mobile) will be ignored. If you identify visitors on the login page and they navigate to another area that doesn't have identification, we will keep the data we already have.

    To explicitly remove any piece of data, set it to null (web), .remove (iOS), or pass null (Android).

    Logging the Visitor Out

    You can log the visitor out by calling the reset function:

    Upscope('reset');
    

    This will reset the connection and create a new visitor with a new ID.

    Using the Lookup Code

    Learn more about the lookup code on the dedicated page.