• <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 发送事件

        Send event to Google Analytics using API server sided(使用 API 服务器端向 Google Analytics 发送事件)

        <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 发送事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How do I pass parameters into a PHP script through a webpage?(如何通过网页将参数传递给 PHP 脚本?)
                  PHP - include a php file and also send query parameters(PHP - 包含一个 php 文件并发送查询参数)
                  Where can I read about conditionals done with quot;?quot; and quot;:quot; (colon)?(我在哪里可以阅读有关使用“?完成的条件的信息?和“:(冒号)?)
                  Accessing arrays whitout quoting the key(在不引用键的情况下访问数组)
                  What is the name for the quot;lt;lt;lt;quot; operator?(“lt;lt;lt;的名字是什么?操作员?)
                  default as first option in switch statement?(默认为 switch 语句中的第一个选项?)

                    <bdo id='wAcT5'></bdo><ul id='wAcT5'></ul>
                          <tbody id='wAcT5'></tbody>
                      • <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>