如何将 Intercom.io JS 与 WordPress 和 Typeform 集成

How to integrate Intercom.io JS with WordPress and Typeform

我想将在我的 WordPress 网站上使用 Typeform 收集的信息发送到我的 Intercom 帐户。

我很确定要做到这一点,我需要在 Typeform 数据的 Intercom 中创建自定义属性。

我目前正在使用 Wordpress 的对讲插件。 Intercom 告诉我,我需要将 JS 用于自定义属性,因为该插件不支持该功能。

我知道如何在页脚中插入 Intercom JS 脚本。但是,我不知道如何以正确的方式设置脚本。

更具体地说:

  1. Intercom 手册指出,在 WordPress 中插入 JS 时,我应该更改 JS 中的用户数据以匹配我的站点。我在哪里可以在 Wordpress 中找到这些数据?

这是PHP的对讲JS:

<script> window.intercomSettings = { app_id: "da0xoenf", name: "<?php echo $current_user->name ?>", // Full name email: "<?php echo $current_user->email ?>", // Email address created_at: <?php echo strtotime($current_user->created_at) ?> // Signup date as a Unix timestamp }; </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/da0xoenf';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>

  1. 如何将 typeform 与对讲机集成?如何以及在何处创建自定义属性?

所以听起来您正忙于尝试将 Typeform 数据传输到 Intercom。让我们退后一步,看看主要问题和局限性:

  1. 您想从 Typeform 获取信息到 Intercom
  2. Intercom WordPress 插件目前不支持自定义属性
  3. 自定义属性如何工作以及它们是如何创建的?!

既然我们已经解决了这个问题,我将建议采用更简单的方法并链接您的 TypeForm > Zapier > Intercom。这样你就不需要弄乱任何后端代码,你可以很好地快速完成这个设置。这是一个可以帮助您入门的 Zapier 模板:https://zapier.com/app/editor/template/912

关于自定义属性,它们本质上是应该与大多数用户相关的简短信息。例如。 'Account Type'、'Account Status'、'Number of Projects' 等

您可以在 Intercom 中创建它们,但只需将它们发送给我们也可以。您需要做的就是将它们添加到您的 Javascript 代码段中,它们将自动创建。这是一个例子:

{ 
  app_id: 'abc',
  email: 'mycustomer@hisemail.com',
  name: 'My Customer',
  'Account Status': 'Trial'
}

这样的事情会创建一个用户(如果他们不存在),其电子邮件、名称和名为 'Account Status' 的自定义属性设置为 'Trial'。

文档站点上提供了有关自定义属性的更多详细信息: Custom Attributes