Open: /app/views/client/themename/structure.pdt
Add this to the footer or header:
<script type="text/javascript">
window.$crisp=[];window.CRISP_WEBSITE_ID="WEBSITE-ID-HASH";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.chat/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();
window.CRISP_READY_TRIGGER = function() {
if ($crisp.is("chat:opened") === true) {
<?php if($this->Html->ifSet($logged_in)){ ?>
$crisp.push(["set", "user:nickname", "<?php echo $contact->first_name;echo ' '; echo $contact->last_name; ?>"]);
$crisp.push(["set", "user:email", "<?php echo $contact->email; ?>"]);
$crisp.push(["set", "user:company", "<?php echo $contact->company; ?>"]);
$crisp.push(["set", "user:address1", "<?php echo $this->Html->_($contact->address1); ?>"]);
$crisp.push(["set", "user:address2", "<?php echo $this->Html->_($contact->address2); ?>"]);
$crisp.push(["set", "session:data", ["ipaddress", "<?php echo $ipaddress; ?>"]]);
$crisp.push(["set", "user:country", "<?php echo $this->Html->_($contact->country); ?>"]);
$crisp.push(["set", "user:city", "<?php echo $this->Html->_($contact->city); ?>"]);
$crisp.push(["set", "user:state", "<?php echo $this->Html->_($contact->state); ?>"]);
$crisp.push(["set", "user:postcode", "<?php echo $this->Html->_($contact->zip); ?>"]);
$crisp.push(["set", "user:id", "<?php echo $this->Html->_($client->id_code); ?>"]);
$crisp.push(["set", "user:phonenumber", "<?php echo $this->Html->_($contact->numbers); ?>"]);
$crisp.push(["set", "user:role", "<?php echo $this->Html->_($contact->title); ?>"]);
$crisp.push(["set", "session:data", ["created", "<?php echo strtotime($client->date_added); ?>"]]);
$crisp.push(["set", "session:data", ["company", "<?php echo $this->Html->_($contact->company); ?>"]]);
$crisp.push(["set", "session:data", ["contact_type", "<?php echo $this->Html->_($contact->contact_type); ?>"]]);
$crisp.push(["set", "session:data", ["date added", "<?php echo $client_created; ?>"]]);
<?php } ?>
}
};
</script>
Just change WEBSITE-ID-HASH to your hash given to you by email in the crisp welcome email.