我之前可能已经提到过这一点,但我已经为我的客户设计和编码了许多 HTML 电子邮件模板。虽然我目前使用的电子邮件服务可以跟踪点击率、退回率和打开率,但情况并非总是如此。我不得不依靠自己的方法来跟踪点击率和打开率。以下是您的操作方法。
跟踪点击率:电子邮件 HTML
<a href="http://mydomain.com/landing.php?e=email@address.com">Click here</a> for more information!
跟踪点击率:PHP
// (inside "landing.php") if(isset($_GET['e'])) { //validate and record click-through here }
跟踪点击率是比较容易的部分。您所做的就是将 $_GET 变量附加到链接并在网站上侦听该变量。简单的!
跟踪打开:HTML
<img src="http://mydomain.com/emails/record.php?e=email@address.com" alt="Tracker" />
跟踪打开:PHP
// (inside "record.php") header('Content-Type: image/gif'); if(isset($_GET['e'])) { //validate and record click-through here } //push out image if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } header('Pragma: public'); // required header('Expires: 0'); // no cache header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-Disposition: attachment; filename="blank.gif"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.filesize('blank.gif')); // provide file size readfile('blank.gif'); // push it out exit();
这涉及到更多。您需要首先告诉 PHP 文件它应该作为图像提供。然后,您读取 $_GET 变量值并记录用户已请求该文件。最后,您推出实际图像。
当然,这不是电子邮件跟踪的最佳方法。您会错过弹跳报告、转发和许多其他重要统计数据。但是,您确实获得了最重要的信息:谁查看了您的电子邮件?