Home php教程 php手册 博客评论回访者跟踪

博客评论回访者跟踪

Jun 06, 2016 pm 08:07 PM
about blog Comment track

之前写了一大堆关于Google Analytics的文章,现在又想折腾回访者的跟踪 主要想了解评论者收到评论回复邮件后,回访博客的情况和行为 Analytics有跨域跟踪的功能,还可以传递cookies,但是在邮件里加入js,邮件提供商是否允许在邮件里运行js还是个问题, 折腾

之前写了一大堆关于Google Analytics的文章,现在又想折腾回访者的跟踪

主要想了解评论者收到评论回复邮件后,回访博客的情况和行为

Analytics有跨域跟踪的功能,还可以传递cookies,但是在邮件里加入js,邮件提供商是否允许在邮件里运行js还是个问题,

折腾了半天想到一个简单的办法,不过只能确定是否通过提醒邮件回访了博客

方法很简单,就是改造评论回复提醒邮件的链接,现在的短链接服务都提供统计功能,我把邮件内的链接替换为bit.ly的短链

这个链接除了收信人能点击到,还有我自己到bit.ly的后台能点击,其他人是不知道这个链接的

而每封评论回复提醒邮件的地址由于评论不同,生成的短链不同,因此只要通过后台查看这些链接是否被点击过就能了解到评论者是否回访了

这个方法也没完全解决需求,如果评论回访者没通过邮件连接,而是直接输入地址或者其他外链进来的,就没法跟踪到了

那样的话,可以通过判断cookies里是否有author_comments字段,不过本文不介绍那个方法

P.S.文章写的时间有点早了,现在已经使用了多说评论系统,暂时没法跟踪评论者点击提醒链接,如果你还是使用本地发送提醒链接,可以接着往下看

我之前使用的是Comment Reply Notification插件来实现评论提醒,找到228行的

$permalink =  get_comment_link($parent_id);
$mail_message = str_replace('[commentlink]', $permalink . "#comment-{$parent_id}", $mail_message);
Copy after login

修改为如下代码

$permalink =  get_comment_link($parent_id);
$linksource = '?utm_source=s.xfeng.me&utm_medium=mail&utm_campaign=myblog_link#';
$tmplink = str_replace('#',$linksource,$permalink);
$encodelink = urlencode($tmplink);
$biturl ="http://api.bit.ly/v3/shorten?login=your_username&apiKey=your_apikey&longUrl=$encodelink&format=json";
function bitly_curl( $url )
{
		if ( ! isset( $url ) )
				return false;
		if ( function_exists( 'curl_init' ) )
		{
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				curl_setopt($ch, CURLOPT_URL, $url );
				$result = curl_exec($ch);
				curl_close($ch);
		}else{
				$result = file_get_contents( $url );
		}
		if ( ! empty( $result ) ) return json_decode( $result, true );
		return false;
}
$shortlink_response = bitly_curl($biturl);
if ( is_array( $shortlink_response )  && $shortlink_response['status_code'] == 200 )
{
		$shortlink = $shortlink_response['data']['url'];
}else{
		$shortlink = $tmplink;
}
$mail_message = str_replace('[commentlink]', $shortlink, $mail_message);
Copy after login

我这里给链接加了utm_source、utm_medium、utm_campaign,可以在Analytics里查看到这些链接被打开的数据,你也需要修改自己的utm_source

另外需要修改代码里biturl的your_username和your_apikey,替换为你自己的bit.ly用户名和apikey

邮件效果如下

这样你就能知道访客是否通过邮件回访了,虽然不完全满足需求,不过也算实现了一点功能吧

用Wordpress就得瞎折腾


作者:小峰JoysBoy@小峰网络遨游记 | About Me
地址:https://xfeng.me/comment-return-visitor-track/ | 4 条评论,看看别人说了些什么 | 03/19/2012
Category: PHP, wordpress
Post Tags: plugin, track, wordpress
本博客原创文字只代表本人某一时间内的观点或结论,与本人所在公司没有任何关系。
第三方若用于商业用途的转载,须取得本人授权。
Twitter | Google+ | FaceBook | DouBan | Yupoo | Flickr | Wakoopa
Copyright ? 2006 - 2012 XFeng.Me All Rights Reserved.
(详情请访问本站:小峰网络遨游记)


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Why is the latest comment on Xiaohongshu at the bottom? How does Xiaohongshu make its comments number one? Why is the latest comment on Xiaohongshu at the bottom? How does Xiaohongshu make its comments number one? Mar 21, 2024 pm 06:21 PM

As a popular social e-commerce platform, Xiaohongshu’s user comments are an important interactive link. Many users find that on Xiaohongshu, the latest comments often appear at the bottom of the comment area. Why is this? This article will delve into the sorting mechanism of Xiaohongshu’s comment area and share some tips for ranking comments at the front. 1. Why are the latest comments on Xiaohongshu at the bottom? The default sorting method of the Xiaohongshu comment area is to display comments in chronological order, that is, the latest comments will be displayed at the bottom of the comment area. This sorting method helps users easily view the latest comments and obtain real-time information. Xiaohongshu encourages interaction between users and encourages users to actively participate in comments by placing the latest comments at the bottom of the page. This design allows users to browse other users’ comments,

Why is Xiaohongshu's own comment at the bottom? How to modify a comment on Xiaohongshu? Why is Xiaohongshu's own comment at the bottom? How to modify a comment on Xiaohongshu? Mar 21, 2024 pm 10:46 PM

Xiaohongshu is a popular social e-commerce platform where users can share shopping tips, recommend products and exchange shopping experiences. Some users found that comments they posted on Xiaohongshu were always displayed at the bottom, which confused them. This article will explore why Xiaohongshu’s comments arrangement causes user comments to appear at the bottom, and introduce how to modify the position of comments on Xiaohongshu. 1. Why are Xiaohongshu’s own comments at the bottom? The display order of comments on Xiaohongshu is usually based on the chronological order of the comments. If your comment is posted after another user has commented, it will appear at the bottom. This is Xiaohongshu’s default comment sorting method, which is designed to maintain order and clarity in the comment area. Xiaohongshu may based on the content of the comments

How do I delete my comments on TikTok? How can others find out my comments on TikTok? How do I delete my comments on TikTok? How can others find out my comments on TikTok? Mar 21, 2024 pm 10:41 PM

People enjoy posting videos, browsing videos, commenting and interacting on Douyin. But in the comment interaction, sometimes we may make some inappropriate remarks or make mistakes and want to delete these comments. So how to delete my own comments on Douyin? 1. How to delete my comments on Douyin? 1. Log in to Douyin App and find the video with the comment you want to delete. 2. At the bottom of the video page, find a list of all comments. 3. Find your comment, click the heart icon (like) on the right side of the comment, then click the delete icon (trash can) to confirm deletion. 4. If you @ other people in the comment, you will receive a prompt when deleting the comment: "After deleting this comment, the person @ will not receive the notification." If you want the person @ to receive the notification, you can Cancel @ first,

Why can't others see my comments on Xiaohongshu? Why can't others see its comments? Why can't others see my comments on Xiaohongshu? Why can't others see its comments? Mar 21, 2024 pm 07:51 PM

Xiaohongshu is a popular social media platform where users can share their lives and exchange experiences. Some users will find that when they comment on other people's posts, they cannot see it. So, why can’t others see my comments on Xiaohongshu? This article will explore this issue in detail to help you resolve your confusion. 1. Why can’t others see my comments on Xiaohongshu? Delayed review: Xiaohongshu review content has been reviewed and may be temporarily hidden due to containing sensitive words or illegal content. In this case, the other party may not be able to see the comment temporarily after it is posted. Generally, these comments will reappear once moderation is complete. Account anomalies may cause comments posted by commenters not to be seen by the other party, even if the comments are successfully posted. Such abnormal situations include accounts being banned or functions limited.

Why can't pictures be displayed in Xiaohongshu comments? Why is the Xiaohongshu IP address not updated? Why can't pictures be displayed in Xiaohongshu comments? Why is the Xiaohongshu IP address not updated? Mar 21, 2024 pm 09:00 PM

Xiaohongshu is a popular social e-commerce platform where users can share their shopping experiences and recommend products. Some users reported that they were troubled by the fact that the images they uploaded in their comments were not displayed properly. This article will help you find out why images in Xiaohongshu comments cannot be displayed and provide solutions. 1. Why can’t pictures be displayed in Xiaohongshu comments? Image formats may not be supported: Xiaohongshu’s comment function only supports limited image formats. If the image format you upload is not supported, the image may not be displayed. It is recommended that you try other formats, such as JPG, PNG, etc. The size of images uploaded in comments may be limited by Xiaohongshu. If the size of your image is too large, it may not be displayed properly. It is recommended that you try pressing

How can I retrieve someone else's deleted comment on Xiaohongshu? Will it be displayed if someone else's comment is deleted? How can I retrieve someone else's deleted comment on Xiaohongshu? Will it be displayed if someone else's comment is deleted? Mar 21, 2024 pm 10:46 PM

Xiaohongshu is a popular social e-commerce platform, and interactive comments between users are an indispensable method of communication on the platform. Occasionally, we may find that our comments have been deleted by others, which can be confusing. 1. How can I retrieve someone else’s deleted comments on Xiaohongshu? When you find that your comments have been deleted, you can first try to directly search for relevant posts or products on the platform to see if you can still find the comment. If the comment is still displayed after being deleted, it may have been deleted by the original post owner. At this time, you can try to contact the original post owner to ask the reason for deleting the comment and request to restore the comment. If a comment has been completely deleted and cannot be found on the original post, the chances of it being reinstated on the platform are relatively slim. You can try other ways

How to pin comments to the top of Xiaohongshu on the computer? Where are the private messages on the computer? How to pin comments to the top of Xiaohongshu on the computer? Where are the private messages on the computer? Mar 28, 2024 pm 12:36 PM

On Xiaohongshu, users can browse a variety of beauty, fashion, travel and other content, while also expressing their own opinions and comments. Some users encountered the problem of how to pin comments when using the Xiaohongshu computer version. 1. How to pin comments to the top of Xiaohongshu on the computer? 1. Open the computer version of Xiaohongshu and enter the post or update you want to comment on. 2. In the comment area, find the comment you want to pin. 3. Click on the comment and you will see a "Pin" button. 4. Click the "Pin" button, and the comment will appear at the top of the comment area and become a pinned comment. It should be noted that the Xiaohongshu computer version currently only supports pinning your own comments, and the pinning function is only valid in the comment area of ​​posts or updates, and cannot be pinned on topic pages or global comment areas. two,

Path tracing and ray tracing for game visual effects Path tracing and ray tracing for game visual effects Feb 19, 2024 am 11:36 AM

The decision to use path tracing or ray tracing is a critical choice for game developers. Although they both perform well visually, there are some differences in practical applications. Therefore, game enthusiasts need to carefully weigh the advantages and disadvantages of both to determine which technology is more suitable for achieving the visual effects they want. What is ray tracing? Ray tracing is a complex rendering technique used to simulate the propagation and interaction of light in virtual environments. Unlike traditional rasterization methods, ray tracing generates realistic lighting and shadow effects by tracing the path of light, providing a more realistic visual experience. This technology not only produces more realistic images, but also simulates more complex lighting effects, making scenes look more realistic and vivid. its main concepts

See all articles