<!-- Head -->
<script src="https://wchat.freshchat.com/js/widget.js"></script>
<!-- Head -->
<script>
window.fcWidget.init({
token: "WEB_CHAT_TOKEN",
host: "https://wchat.freshchat.com",
externalId: "john.doe1987", // user’s id unique to your system
firstName: "John", // user’s first name
lastName: "Doe", // user’s last name
email: "john.doe@gmail.com", // user’s email address
phone: "8668323090", // phone number without country code
phoneCountryCode: "+1" // phone’s country code
});
</script>
I would like to pass User's first name and email into my js chat script. I know that I should be able to grab the customer session using the object manager like so:
<?php
$customerSession = $om->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) {
echo $customerSession->getCustomer()->getId()."<br/>"; // get Customer Id
echo $customerSession->getCustomer()->getName()."<br/>"; // get Full Name
echo $customerSession->getCustomer()->getEmail()."<br/>"; // get Email Name
}
?>
Would I pass the two variables by just echo'ing them out inside the quotations?