doubenggua9430 2014-02-09 14:26
浏览 35
已采纳

php - 如何跟踪用户离开我的网站后访问的页面? [关闭]

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....

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

  • 写回答

3条回答 默认 最新

  • duandao8607 2014-02-09 14:33
    关注

    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);
         }
    }
    

    then use in the <a></a>

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

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 7-1 jmu-java-m02-使用二维数组存储多元线性方程组
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题