How to collect user's session data and auto login within your Live Chat

Do you have a web session on your website? Do you want to auto-login people even in your Live Chat? 


This way when your user will log into your platform and he wants to open a new ticket, Customerly will recognize him immediately. 


Benefits for you are various:

  1. Users will have less friction by opening a ticket
  2. You will have all the ticket's track records for the same user
  3. You can collect useful information about your customers to speed up the customer service


If you have integrated the basic snippet, this is how you can add attributes. In the following example, we added the user id = 4, the name and email and three attributes.


<script>
    window.customerlySettings = {
        app_id: "00c4ed07",

        user_id: 4, // Optional
        name: "Sarah", 
        email: "sara@company.com", 
        

        //Add your custom attributes of the user you want to track
        attributes: {
            subscription_type: "2",
            created_at: 1384902000, // Signup date as a Unix timestamp
            license_expire_at: 1603490400
        }
       
    };
    !function(){function e(){var e=t.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.customerly.io/widget/00c4ed07";var r=t.getElementsByTagName("script")[0];r.parentNode.insertBefore(e,r)}var r=window,t=document,n=function(){n.c(arguments)};r.customerly_queue=[],n.c=function(e){r.customerly_queue.push(e)},r.customerly=n,r.attachEvent?r.attachEvent("onload",e):r.addEventListener("load",e,!1)}();
</script>


The attributes array is customizable with an infinite number of custom data. 

Do you want to track your user plan and trial status? It's easy, just add another line of code like this:


  attributes: {
            subscription_type: "2",
            created_at: 1384902000, // Signup date as a Unix timestamp
            license_expire_at: 1603490400,
            plan: "pro",
            status: "trial"
        }


If the user sign in again and you change the status from trial to paying, we will update instantly the data point on our side. This will help you track your user status and also this will help you creating funnels that will be triggered automatically based on your user status. 


The attributes can be of different types:

  • String (eg. Pro)
  • Number (eg. 1,2,10000)
  • Date (only timestamp in seconds will be accepted)
  • Boolean (true or false, 0 or 1)

We try to recognize the attribute type automatically, but in some cases, you might want to customize the attribute type in your settings.