Online Chat Integration (Tawk.to) on Website
Tawk.to is a free online chat with unlimited operators and chat history. Monetized through operator hiring services. Suitable for startups and small companies.
Widget Installation
<script type="text/javascript">
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/{PROPERTY_ID}/{WIDGET_ID}';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
JavaScript API
// User identification
Tawk_API.onLoad = function(){
Tawk_API.setAttributes({
name: user.name,
email: user.email,
id: user.id
}, function(error){});
};
// Programmatic opening
Tawk_API.maximize();
// Hide widget on specific pages
if (window.location.pathname.startsWith('/checkout')) {
Tawk_API.hideWidget();
}
Secure Mode (Authenticated Visitor)
To protect against user ID spoofing:
// On server: generate hash
$hash = hash_hmac('sha256', $user->email, env('TAWK_API_KEY'));
Tawk_API.onLoad = function() {
Tawk_API.setAttributes({
email: '<?= $user->email ?>',
hash: '<?= $hash ?>'
});
};
Setup timeframe: a few hours.







