跟踪用户是否打开了电子邮件
Track whether user has opened an email or not
我正在使用 MailChimp PHP API,我想知道如何跟踪用户是否查看了发送的电子邮件。我认为我应该在发送给用户的消息中写入某种类型的代码。无论如何,这就是我连接到 mailchimp 的方式:
// Post data retrieved from ajax post
$fullName = mysqli_real_escape_string($con, $_POST['fname']);
$email = mysqli_real_escape_string($con,$_POST['email']);
////////////////////////////////////////////////
///////MailChimp Integration////////////////////
///////////////////////////////////////////////
// Subscribe a user to MailChimp
$MailChimp = new MailChimp('id');
$result = $MailChimp->post('lists/id/members', array(
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => array('FNAME'=>$fullName, 'LNAME'=>'')
));
$message = "<html><body>";
$message .= "<p>";
$message .= "Hi $fullName, <br><br><br>";
[..]
我宁愿使用 mailchimp,但如果有任何其他解决方案,请告诉我。我还通过mysqli.
将数据存储在mysql数据库中
我的 2 美分 - 要回答的评论。
您可以做的一件事是使用可追踪的 link。例如;您的邮件有关于某事的故事,但您没有包含完整的故事。
所以...您有一个 link 和 "Read the full story",带有可跟踪的 href。
这有点偷偷摸摸,但行得通并且不违法。魔术发生在查询的 WHERE 子句中。
我认为 Mailchimp 在跟踪消息是否被打开时所做的(我们也使用 Mailchimp),他们也可能使用图像方法来跟踪 and/or 基于时事通讯中的 href;我注意到当未加载图像或未单击 links 时,数字不会增加。
有没有注意到 href 在邮件中的样子?它们不是你的,它们带有特殊代码。
如果您在邮件中的源 link 代码是 http://www.example.com/file.xxx
,那么 Mailchimp 会将其更改为类似以下内容以跟踪点击的 links。
例如:
http://yourdomain.usX.list-manage.com/track/click?u=alpha-numerical-set-of-characters
要在 MySQL 中使用计数器,例如使用更新:
UPDATE TABLE SET col_x = col_x +1 WHERE col_y = 'something'
更新参考:
我正在使用 MailChimp PHP API,我想知道如何跟踪用户是否查看了发送的电子邮件。我认为我应该在发送给用户的消息中写入某种类型的代码。无论如何,这就是我连接到 mailchimp 的方式:
// Post data retrieved from ajax post
$fullName = mysqli_real_escape_string($con, $_POST['fname']);
$email = mysqli_real_escape_string($con,$_POST['email']);
////////////////////////////////////////////////
///////MailChimp Integration////////////////////
///////////////////////////////////////////////
// Subscribe a user to MailChimp
$MailChimp = new MailChimp('id');
$result = $MailChimp->post('lists/id/members', array(
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => array('FNAME'=>$fullName, 'LNAME'=>'')
));
$message = "<html><body>";
$message .= "<p>";
$message .= "Hi $fullName, <br><br><br>";
[..]
我宁愿使用 mailchimp,但如果有任何其他解决方案,请告诉我。我还通过mysqli.
将数据存储在mysql数据库中我的 2 美分 - 要回答的评论。
您可以做的一件事是使用可追踪的 link。例如;您的邮件有关于某事的故事,但您没有包含完整的故事。
所以...您有一个 link 和 "Read the full story",带有可跟踪的 href。
这有点偷偷摸摸,但行得通并且不违法。魔术发生在查询的 WHERE 子句中。
我认为 Mailchimp 在跟踪消息是否被打开时所做的(我们也使用 Mailchimp),他们也可能使用图像方法来跟踪 and/or 基于时事通讯中的 href;我注意到当未加载图像或未单击 links 时,数字不会增加。
有没有注意到 href 在邮件中的样子?它们不是你的,它们带有特殊代码。
如果您在邮件中的源 link 代码是 http://www.example.com/file.xxx
,那么 Mailchimp 会将其更改为类似以下内容以跟踪点击的 links。
例如:
http://yourdomain.usX.list-manage.com/track/click?u=alpha-numerical-set-of-characters
要在 MySQL 中使用计数器,例如使用更新:
UPDATE TABLE SET col_x = col_x +1 WHERE col_y = 'something'
更新参考: