tawkto bring customer data

This commit is contained in:
iBNu Maksum 2024-10-22 10:34:44 +07:00
parent 53aa187d1f
commit 8086802bf6
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 119 additions and 89 deletions

View File

@ -852,5 +852,6 @@
"info": "info",
"Registration_code": "Registration code",
"Admin_can_only_have_single_session_login__it_will_logout_another_session": "Admin can only have single session login, it will logout another session",
"Single_session_Admin": "Single session Admin"
"Single_session_Admin": "Single session Admin",
"Get_Directions": "Get Directions"
}

View File

@ -56,8 +56,34 @@
{if $_c['tawkto'] != ''}
<!--Start of Tawk.to Script-->
<script type="text/javascript">
var Tawk_API = Tawk_API || {},
Tawk_LoadStart = new Date();
var isLoggedIn = false;
var Tawk_API = {
onLoad: function() {
if (!isLoggedIn) {
isLoggedIn = true;
window.Tawk_API.login({
name: '{$_user['fullname']}',
email: '{$_user['email']}',
userId: '{$_user['id']}'
}, function(error) {
//do something if there's an error
});
}
Tawk_API.setAttributes({
'id' : '{$_user['id']}',
'username' : '{$_user['username']}',
'service_type' : '{$_user['service_type']}',
'balance' : '{$_user['balance']}',
'account_type' : '{$_user['account_type']}',
'phone' : '{$_user['phonenumber']}'
}, function(error) {});
}
};
var Tawk_LoadStart = new Date();Tawk_API.visitor = {
name : '{$_user['fullname']}',
email : '{$_user['email']}',
userId: '{$_user['id']}'
};
(function() {
var s1 = document.createElement("script"),
s0 = document.getElementsByTagName("script")[0];
@ -101,6 +127,7 @@
});
</script>
{literal}
<script>
var listAtts = document.querySelectorAll(`[api-get-text]`);
@ -159,7 +186,9 @@
}
return null;
}
setCookie('user_language', '{/literal}{$user_language}{literal}', 365);
setCookie('user_language', '
{/literal}{$user_language}
{literal}', 365);
</script>
{/literal}