• <tfoot id='xoEmD'></tfoot>

    <small id='xoEmD'></small><noframes id='xoEmD'>

      <i id='xoEmD'><tr id='xoEmD'><dt id='xoEmD'><q id='xoEmD'><span id='xoEmD'><b id='xoEmD'><form id='xoEmD'><ins id='xoEmD'></ins><ul id='xoEmD'></ul><sub id='xoEmD'></sub></form><legend id='xoEmD'></legend><bdo id='xoEmD'><pre id='xoEmD'><center id='xoEmD'></center></pre></bdo></b><th id='xoEmD'></th></span></q></dt></tr></i><div id='xoEmD'><tfoot id='xoEmD'></tfoot><dl id='xoEmD'><fieldset id='xoEmD'></fieldset></dl></div>

          <bdo id='xoEmD'></bdo><ul id='xoEmD'></ul>
      1. <legend id='xoEmD'><style id='xoEmD'><dir id='xoEmD'><q id='xoEmD'></q></dir></style></legend>
      2. 使用 API 服务器端向 Google Analytics 发送事件

        时间:2023-06-23

        <small id='rnLBu'></small><noframes id='rnLBu'>

        1. <tfoot id='rnLBu'></tfoot>
          1. <legend id='rnLBu'><style id='rnLBu'><dir id='rnLBu'><q id='rnLBu'></q></dir></style></legend>

                <tbody id='rnLBu'></tbody>
              <i id='rnLBu'><tr id='rnLBu'><dt id='rnLBu'><q id='rnLBu'><span id='rnLBu'><b id='rnLBu'><form id='rnLBu'><ins id='rnLBu'></ins><ul id='rnLBu'></ul><sub id='rnLBu'></sub></form><legend id='rnLBu'></legend><bdo id='rnLBu'><pre id='rnLBu'><center id='rnLBu'></center></pre></bdo></b><th id='rnLBu'></th></span></q></dt></tr></i><div id='rnLBu'><tfoot id='rnLBu'></tfoot><dl id='rnLBu'><fieldset id='rnLBu'></fieldset></dl></div>
                <bdo id='rnLBu'></bdo><ul id='rnLBu'></ul>

                  本文介绍了使用 API 服务器端向 Google Analytics 发送事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个网站,我使用 javascript 函数将事件发送到 Google Analytics:

                  I have a website where I send events to Google Analytics using javascript function:

                  ga('send', 'event', 'showphone', 'feedback', 'result');

                  但是我还需要使用 PHP 从 server-side 发送一些类似的事件.我尝试了这个快速入门教程:Hello Analytics API:PHP 快速入门对于服务帐户 和报告的作用就像一个魅力,但我不知道如何发送事件.

                  However I also need to send some similar events from server-side using PHP. I tried this quick start tutorial: Hello Analytics API: PHP quickstart for service accounts and reporting works like a charm, but I have no idea how to send event.

                  能否请您逐步向我展示我应该编写什么代码来发送与上述完全相同的事件.

                  Could you please show me step-by-step what I should code to send exactly same event like mentioned above.

                  推荐答案

                  Hello Analytics API:服务帐户的 PHP 快速入门 根本不会帮助您.该代码使用核心报告 API,核心报告 API 用于请求来自 Google Analytics 的数据,而不是 Google Analytics 发送数据.

                  Hello Analytics API: PHP quickstart for service accounts is not going to help you at all. That code uses the core reporting API the core reporting API is for requesting data from Google Analytics not sending data to Google Analytics.

                  要将数据发送到 Google Analytics,我们使用测量协议.测量协议用于向 Google Analytics 发送信息,您发布的 JS 代码段也使用测量协议.

                  To send data to Google Analytics we use the Measurement Protocol. The measurement protocol is used to send information to Google analytics the JS snippet you posted also uses the measurement protocol.

                  您可以使用任何支持 HTTP post 或 Http Get 的语言的测量协议.话虽如此,但没有特定于 PHP 的库可用于将信息发送到 Google 分析,您将不得不自己格式化您的帖子.一个提示是使用 Validating hits 来检查它在开发过程中将其发送给 Google 之前.

                  You can use the measurement protocol from any language that supports HTTP post or Http Get. That being said there is no PHP specific library for sending information to Google analytics you are going to have to format your post yourself. A tip would be to use Validating hits to check it before you send it to Google while you are developing this.

                  它可能看起来像这样

                  http://www.google-analytics.com/collect?v=1&tid=UA-XXX-Y&cid=35009a79-1a05-49d7-b876-2b884d0f825b&an=My%20Awesom%20APP&aid=com.daimto.awesom.app&av=1.0.0&aiid=come.daimto.awesom.installer &t=event&ec=list&ea=accounts&userclicked&ev=10
                  

                  这篇关于使用 API 服务器端向 Google Analytics 发送事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:可嵌入的谷歌分析“天赋"? 下一篇:GAPI:无法验证用户.永久修复 PHP

                  相关文章

                    <bdo id='wAcT5'></bdo><ul id='wAcT5'></ul>
                • <tfoot id='wAcT5'></tfoot>
                  <i id='wAcT5'><tr id='wAcT5'><dt id='wAcT5'><q id='wAcT5'><span id='wAcT5'><b id='wAcT5'><form id='wAcT5'><ins id='wAcT5'></ins><ul id='wAcT5'></ul><sub id='wAcT5'></sub></form><legend id='wAcT5'></legend><bdo id='wAcT5'><pre id='wAcT5'><center id='wAcT5'></center></pre></bdo></b><th id='wAcT5'></th></span></q></dt></tr></i><div id='wAcT5'><tfoot id='wAcT5'></tfoot><dl id='wAcT5'><fieldset id='wAcT5'></fieldset></dl></div>

                • <small id='wAcT5'></small><noframes id='wAcT5'>

                  <legend id='wAcT5'><style id='wAcT5'><dir id='wAcT5'><q id='wAcT5'></q></dir></style></legend>