我想跟踪 API 的使用情况。所以我使用 Zend_Http_Client 将 POST 参数发送到 Google Analytic 的收集器。 Google developers-page告诉我,我必须发送一个 cid
(匿名客户端 ID)。但是当它是 _ga-cookie
的一部分时,我如何通过 PHP 发送它?
我应该创建自己的cid
吗?还是我太笨了,看不懂手册?
谢谢!
最佳答案
所有参数直接通过Measurement protocol发送必须由您创建。
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
我通常使用GUID为了这。似乎有一个 PHP 函数可以执行此操作: com_create_guid或者也许uniqid
答案:
- 是的,您应该创建自己的 cid。
- 不,测量协议(protocol)非常难以理解,而且在很多情况下文档也不清楚。这与你的智力无关。
提示:
- 您可以使用 Validateing hits 测试您的请求.
- 使用测量协议(protocol)跟踪配额的教程:Monitoring Quota usage for Google APIs
关于php - 在 PHP/Zend 框架中获取 Google Analytics 的 cid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30073633/