php - 如何跟踪用户离开我的网站后访问的网页? [英] php - How to track pages visited by users after they leave my website?

查看:130
本文介绍了php - 如何跟踪用户离开我的网站后访问的网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,人们可以搜索从25个网站收集的产品的最便宜的价格。它不是一个电子商务网站,它只是一个网站试图增加这25个网站的流量。
因此,我想跟踪我的用户,他们点击产品,并定向到这些电子商务网站....

I have a website where people can search for cheapest prices of products gathered from 25 websites. It is not an e-commerce site, it's just a site trying to increase the traffic of those 25 sites. Therefore I want to track my users after they click the products and directed to those e-commerce sites....

我已经阅读了很多关于PHP饼干,但那些没有解决我的问题。
感谢

I have read a lot about PHP cookies but those did not solve my problem. Thanks

推荐答案

如果您使用 Google Analytics(分析),您还可以按以下方式跟踪点击次数:

If you use Google Analytics you can also track clicks as follows:

function trackOutboundLink(link, category, action, opt_label) { // google analytics tracking
    try { 
    _gaq.push(['_trackEvent', category , action, opt_label]); 
    } catch(err){}

    if (link.target == '_blank')
        window.open(link.href);
     else {
        setTimeout(function() {
        document.location.href = link.href;
        }, 100);
     }
}

然后在 ; a>< / a>

<a onclick="trackOutboundLink(this, 'CategoryName', 'ActionName', 'LabelName'); return false;" href="whatever.html" target="_blank">External Website Name</a>

其中 CategoryName ActionName LabelName 可以是您想要的任何内容,并会显示在Google Analytics(分析)中

where CategoryName, ActionName and LabelName can be anything you want and will show in Analytics

这篇关于php - 如何跟踪用户离开我的网站后访问的网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆