[Follow Up] intercom.io & MailWizz integration

Jesse James

Member
Hey guys,

Hope you're doing alright.

This is just a follow for this post:
https://forum.mailwizz.com/threads/mailwizz-and-intercom-io-integration.162/

can you guys help me out to set up the Phone and the Group Name on this form
Like this:
PHP:
<?php
$name = $email = $timestamp = null;
if ($customer = Yii::app()->customer->getModel()) {
    $name = $customer->fullName;
    $email = $customer->email;
    $timestamp = strtotime($customer->date_added);
    $phone = $company->getHtmlOptions('phone'));
    $GroupName = I dunno how to get it :(
}
?>
<script>
  window.intercomSettings = {
    // TODO: The current logged in user's full name
    name: "<?php echo $name;?>",
    // TODO: The current logged in user's email address.
    email: "<?php echo $email;?>",
    // TODO: Client Phone Number.
    phone: "<?php echo $phone;?>",
   // TODO: Client Group Name.
    group: "<?php echo $GroupName;?>",
    // TODO: The current logged in user's sign-up date as a Unix timestamp.
    created_at: <?php echo (int)$timestamp;?>,
    app_id: "c81osy6m"
  };
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/c81osy6m';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>

Thank you all :)
 
That's simple:
PHP:
<?php
$name = $email = $timestamp = $phone = $groupName = null;
if ($customer = Yii::app()->customer->getModel()) {
    $name = $customer->fullName;
    $email = $customer->email;
    $timestamp = strtotime($customer->date_added);
    $phone = !empty($customer->company) ? $customer->company->phone : null;
    $groupName = !empty($customer->group) ? $customer->group->name : null;
}
?>
<script>
  window.intercomSettings = {
    // TODO: The current logged in user's full name
    name: "<?php echo $name;?>",
    // TODO: The current logged in user's email address.
    email: "<?php echo $email;?>",
    // TODO: Client Phone Number.
    phone: "<?php echo $phone;?>",
   // TODO: Client Group Name.
    group: "<?php echo $groupName;?>",
    // TODO: The current logged in user's sign-up date as a Unix timestamp.
    created_at: <?php echo (int)$timestamp;?>,
    app_id: "c81osy6m"
  };
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/c81osy6m';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
 
Back
Top