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.

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

报告相同问题?