olark('api.visitor.getDetails', callback);

Response

  • details.browser
    the browser that this visitor is using (e.g. 'Chrome 12.1')
  • details.city
    approximate city location
  • details.conversationbeginpage
    the URL from which the visitor began their conversation"
  • details.conversationcount
    total number of times this visitor has chatted with an operator"
  • details.country
    approximate country
  • details.countrycode
    approximate country (in ISO-standard format, e.g. UK, DE, JP, etc)
  • details.currentpage
    the current page the visitor is on (has a title and URL)
  • details.customfields.yourfieldnamegoeshere
    you can retrieve any custom fields that you set with api.visitor.updateCustomFields
  • details.emailaddress
    visitor's email address
  • details.fullname
    visitor's full name
  • details.ip
    This will return "not available" in an effort to remove PII from our API.
  • details.isconversing
    will be true if the visitor is having a conversation right now"
  • details.messagecountacrossallvisits
    number of messages sent and received for this visitor all-time on your site"
  • details.messagecountforthisvisit
    number of messages sent and received during this conversation"
  • details.operatingsystem
    the operating system that this visitor is using (e.g. Windows, Mac, or Linux)
  • details.organization
    organization that this visitor might be affiliated with
  • details.pagecountacrossallvisits
    total number of pages that this visitor has viewed all-time on your site
  • details.pagecountforthisvisit
    number of pages that this visitor has viewed during this visit
  • details.phonenumber
    visitor's phone number
  • details.recentpagehistory
    a list of the last 10 pages seen by the visitor (each page has a title and URL)
  • details.referredbycampaignever
    will be true if the visitor came to your site from an email or blogging campaign at some point
  • details.referredbycampaignthisvisit
    will be true if the visitor came to your site from an email or blogging campaign this visit
  • details.referredbypaidadvertisingever
    will be true if the visitor came to your site from a paid advertisement at some point
  • details.referredbypaidadvertisingthisvisit
    will be true if the visitor came to your site from a paid advertisement for this visit
  • details.referrer
    the URL that referred this visitor to your website (e.g. a Google search, advertisement, blog post, etc)
  • details.region
    approximate state or province
  • details.searchtextforpreviousvisits
    search text that was typed in Google, Yahoo, or Bing to get to your site in past visits
  • details.searchtextforthisvisit
    search text that was typed in Google, Yahoo, or Bing to get to your site
  • details.secondssincelastmessage
    seconds since either the visitor or operator sent a message"
  • details.secondssincelastmessagetooperator
    seconds since the visitor sent a message"
  • details.secondssincelastmessagetovisitor
    seconds since the operator sent a message"
  • details.secondssincelastnotificationtooperator
    seconds since the operator last received a notification"
  • details.secondsspentacrossallvisits
    total number of seconds that this visitor has spent on your site over all their visits
  • details.secondsspentforthisvisit
    number of seconds that this visitor has spent on your site
  • details.visitcount
    total number of times this visitor has visited your site

Notes

Gets the email address, full name, geolocation, and other details for this visitor. The value will be returned to the specified returnCallback.

The name, email and phone number fields are the last-known visitor information, either from your pre-chat survey, a completed offline message form, or previously updated via the API.

Geolocation information is provided to the best of our knowledge, based on the visitor’s IP.

Note: As part of our effort to remove personally identifiable information from our API, this call no longer provides access to the visitor’s IP address. Please visit olark.com/help/ipaddresses to learn more.

Notify operators about a certain visitor

Let’s say you wanted to know when a particular customer (e.g. Olark Joe) needed your assistance:

<script>
    olark('api.visitor.getDetails', function(details){

        // Check for an email address
        if (details.emailAddress == "joe@olark.com") {

            olark('api.chat.sendNotificationToOperator', {
                body: "Olark Joe in the house!"
            });

        }
    });
</script>

Target customers in Costa Rica

Let’s say you are targeting customers in San José, the capital of Costa Rica (not San Jose in California):

<script>
olark('api.visitor.getDetails', function(details){

    // Check that both conditions are true
    if (details.city == "San José" && details.region != "California") {

        olark('api.chat.sendNotificationToOperator', {
            body: "this customer might be in San Jose, Costa Rica"
        })

    }

});
</script>

Target customers in Japan

Suppose you are targeting customers in Japan. You can either use the country name or the country code:

<script>
olark('api.visitor.getDetails', function(details){

    if (details.country == "Japan" || details.countryCode == "JP") {

        olark('api.chat.sendNotificationToOperator', {
            body: "this customer might be in Japan"
        });

    }

});
</script>