dsbfbz75185 2013-04-09 11:32
浏览 47
已采纳

使用PHP跟踪网页浏览,事件,自定义var到Google Analytics?

I would like to know the way (if possible) of Google Analytics tracking (pageviews, events, custom vars) using a PHP calls (using POST/GET with cURL or other methods) instead of JavaScript.

The problem is our client want to track some special events that are unable to track using JavaScript or I would have to set special (and generally useless) SESSION variables to check if set and then track using JavaScript and unset them that would lead into nasty code in templates...

I saw some PHP project that should provide such a functionality, but I would like to have it in pure PHP as I am not allowed to integrate such a third-party project into mine.

So my question: Is there a way of tracking Google Analytics from within a PHP code in controllers instead of JavaScript code in templates?

  • 写回答

1条回答 默认 最新

  • dt3999 2013-04-09 11:46
    关注

    The php-ga does exactly what you are looking for. There's an awful lot of variables for the URL building to keep track of for sending your own requests. If you want to dig into and make it yourself - the library you posted is a really good place cause the parts of the URL are easily explained by the code around it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀