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
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统