dttphb59319 2015-05-06 10:08
浏览 65
已采纳

在PHP / Zend Framework中获取Google Analytics的cid

I want to track the usage of an API. So I'm using Zend_Http_Client to send POST-parameters to Google Analytic's collector. The Google developers-page tells me, that I have to send a cid (Anonymous Client ID). But how can I send it via PHP when it is part of the _ga-cookie?

Am I supposed to create my own cid? Or am I just too dumb to understand the manual?
Thanks!

  • 写回答

1条回答 默认 最新

  • duanmibei1929 2015-05-06 10:44
    关注

    All of the parameters sent directly through the Measurement protocol must be created by you.

    Client ID / Cid
    This anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in http://www.ietf.org/rfc/rfc4122.txt

    I normally use a GUID for this. There appears to be a PHP-function that does this: com_create_guid or maybe uniqid

    Anwsers:

    1. Yes you are supposed to create your own cid.
    2. No the measurement protocol is very hard to understand and in a lot of cases the documentation isn't clear. This has nothing to do with your intelligence.

    TIPs:

    1. You can test your requests using Validateing hits.
    2. Tutorial on using the Measurment protocol to track quota: Monitoring Quota usage for Google APIs
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试