Custom script integration

User.com plugins work by injecting a script to your website which enables communication between your site and our API. If you don’t want a plugin you can integrate User.com by yourself. To do so, insert the following code before the closing tag of your website:

Custom script integration

How to set it up?

For users that are logged off (no email address provided)
<script data-cfasync="false" type="text/javascript">
  window.civchat = {
    apiKey: 'YOUR_API_KEY',
  };
</script>
<script data-cfasync="false" type="text/javascript" src="https://<your_app_subdomain>.user.com/widget.js">
</script>
And code for users that are logged in
<script data-cfasync="false" type="text/javascript">
  window.civchat = {
    apiKey: 'YOUR_API_KEY',
    name: "John Doe",
    user_id: "idfromyourdatabase",
    email: "myemail@example.org",
    gender: 2,
    status: 2,
    date_attr: "2017-07-25T14:14:08.612Z",   // Must be a valid ISO 8601 format
    phone_number: "+44754123434", // Must be a valid E.164 format
    score: 0,
    company: {
      name: "My Company",
      company_id: "idfromyourdatabase",
      revenue: "$239.9 billion"
    }
  };
</script>
<script data-cfasync="false" type="text/javascript" src="https://<your_app_subdomain>.user.com/widget.js"></script>

Learn more

Integration via script

How to integrate your data with the User.com database via simple script implementation within your web page source code

Learn more