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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据