更新日期: 2017-11-30

在使用Contact Form作为询盘表单的时候,我们希望收到的邮件能显示以下信息以便快速判断询盘相关信息:

  • IP地址
  • 国家来源
  • 访客从什么流量来源来的
  • 访客在什么页面提交的询盘

默认情况下,我们可以在编辑Form的时候,在 Mail -> Message Body 中,输入下面的内容可以获取两个信息,IP及询盘提交页面这两个信息。

From: [your-name] <[your-email]>

Message:
[your-message]


---------------------------------- 
IP: [_remote_ip]
URL: [_url]

但是,默认情况下,没法直接能显示出IP所在的国家,如果不嫌烦的话,每次百度下IP地址也可以知道国家。但是,作为一个“懒人”,我希望能减少这个无畏的操作,毕竟询盘多,每个都去查挺浪费时间不是 -_-|||

解决方法

安装两个插件:

  • Contact Form 7 Lead info with country
  • GeoIP Detection

激活,然后在 Dashboard-》Settings-》GeoIP Detection 中 Choose data source 中选择 Automatic download & update of Maxmind GeoIP Lite City 并保存。

最后,把在编辑Contact Form中的Mail -》 Message Body中输入:

From: [your-name] <[your-email]>

Message:
[your-message]


---------------------------------- 
[tracking-info]

然后,收到的邮件大概是像下面这样的:

From: Yi <yi@xxx.com>

Message:
test


---------------------------------- 

-- Tracking Info --
The user filled the form on: https://www.xxx.com/contact-us/
The user came to your website from: not set
Landing page on your website: http://www.xxx.com/
IP: 35.2xx.1xx.1xx
Country: United States (US - NA) - Region: California(CA) - Postal Code + City: 94043 Mountain View
Browser is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38

想要的信息基本上都给展示出来了。