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 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的