google-analytics 相关问题

Google Analytics(分析)是Google提供的免费网络分析解决方案,具有多个客户端API,以及用于数据导出和管理的REST API。

Nuxt 上多域的 GA 实现

我需要跟踪客户在多个域、高级流程上的行为: 客户访问brandA.com 客户被重定向到brandB.com以完成他们的操作 客户重定向回胸罩...

回答 1 投票 0

如何在本地主机上禁用谷歌分析

我用它来进行谷歌分析, <iframe src="//www.googletagmanager.com/ns.html?id=GTM-KCQGLT" height="0" width="0" style="display:none;visibility:hidden"></iframe>&...</desc> <question vote="25"> <p>我用它来进行谷歌分析,</p> <pre><code>&lt;noscript&gt; &lt;iframe src=&#34;//www.googletagmanager.com/ns.html?id=GTM-KCQGLT&#34; height=&#34;0&#34; width=&#34;0&#34; style=&#34;display:none;visibility:hidden&#34;&gt;&lt;/iframe&gt;&lt;/noscript&gt; </code></pre> <p>还有这个</p> <pre><code>&lt;script&gt;(function(w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ &#39;gtm.start&#39;: new Date().getTime(), event: &#39;gtm.js&#39; }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != &#39;dataLayer&#39; ? &#39;&amp;l=&#39; + l : &#39;&#39;; j.async = true; j.src = &#39;//www.googletagmanager.com/gtm.js?id=&#39; + i + dl; f.parentNode.insertBefore(j, f);})(window, document, &#39;script&#39;, &#39;dataLayer&#39;, &#39;GTM-KCQGLT&#39;);&lt;/script&gt; </code></pre> <p>当我在本地主机中运行此代码时,我可以禁用此脚本吗?</p> </question> <answer tick="true" vote="58"> <p>使用下面的代码。</p> <pre><code>&lt;script&gt; var host = window.location.hostname; if(host != &#34;localhost&#34;) { // your google analytic code here } &lt;/script&gt; </code></pre> </answer> <answer tick="false" vote="25"> <p>如<a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/user-opt-out" rel="noreferrer">here</a>所述,这是防止进一步的事件发送到Google Analytics的正确方法,即使在初始化<pre><code>ga(...)</code></pre>之后也是如此:</p> <pre><code>if (admin || localhost) { // disable GA: window[&#39;ga-disable-UA-XXXXX-Y&#39;] = true; // enter your tracking ID } </code></pre> <p>现在对 <pre><code>ga(...)</code></pre> 的任何进一步调用都将无效。</p> <p>引用文档:</p> <blockquote> <p>analytics.js 库包含一个 window 属性,当设置为 true 时,会禁止analytics.js 将数据发送到 Google Analytics。当 Google Analytics 尝试设置 cookie 或将数据发送回 Google Analytics 服务器时,它将检查此属性是否设置为 true。如果是,则不会采取任何行动。</p> <p>要禁用跟踪,请将以下窗口属性设置为 true:</p> <p><pre><code>window[&#39;ga-disable-UA-XXXXX-Y&#39;] = true;</code></pre></p> <p>其中值 UA-XXXXX-Y 对应于您要禁用跟踪的属性 ID。</p> </blockquote> </answer> <answer tick="false" vote="3"> <p>转到分析设置,编辑您的网站,然后+添加过滤器来定义排除您的 IP 地址的过滤器。</p> </answer> <answer tick="false" vote="0"> <p>接受的答案对我不起作用,但@Baruch 在原始问题下的评论却成功了。</p> <pre><code>if (/localhost/.test(window.location.hostname)) { return } </code></pre> </answer> </body></html>

回答 0 投票 0

GA4 - 测量协议问题 - gtag + client_id + session_id 未合并到报告中

我们已将 UA 迁移到 GA4。我们使用 gtag.js 进行网站上的大多数活动,并使用测量协议进行购买。 我们注意到测量协议事件有问题

回答 2 投票 0

GA4 谷歌分析。 gtag.js 延迟几秒发送请求,而不是立即发送

问题是向 Google https://www.google-analytics.com/g/collect 发出的请求?不是立即发送,而是在 3-4 秒后发送。我在谷歌的官方文档中寻找解决方案......

回答 1 投票 0

Google 标签管理器与react-ga4

我正在为一个新网站设置分析。我看过很多文章/参考资料,详细介绍了如何使用 Google 跟踪代码管理器设置分析。我还看过使用react-ga或react-ga的文章...

回答 1 投票 0

GA4 中产品范围的自定义维度

目前是否可以在 GA4 中的产品级别添加自定义维度,以便将其用于报告? 例如,如果我发送如下所示的数据: 事件:“购买”, 值:500,

回答 2 投票 0

Google 分析和 iframe 内容 - 所有跟踪都有效吗?

我在这里看到了很多关于谷歌分析跟踪和 iframe 以及如何可能出现一些问题的帖子。也看到了这个:https://developers.google.com/analytics/devguides/collection/...

回答 2 投票 0

尝试了解使用自定义标签和变量的高级 Google 跟踪代码管理器设置

我是一名营销专业人士,一直为客户进行基本的标记和分析。我遇到过一个由具有丰富开发/分析知识的人建立的帐户,我很挣扎......

回答 1 投票 0

找不到模块“ga-gtag”的声明文件

我正在将我的项目从Universal Analytics 更新到GA4,但遇到了很多问题。我正在尝试安装 ga-gtag 模块,以便能够使用新格式发送我的事件...

回答 1 投票 0

如何获取Google Analytics客户端ID

当您通过运行创建analytics.js的新实例时 ga('创建', 'UA-XXXXXXX-Y', {'cookieDomain': '无'}); GA 创建一个唯一的客户端 ID。 我想获取这个 ID 并将其用于我自己的

回答 6 投票 0

我可以将谷歌分析添加到电子邮件中(html/文本版本)吗?

我想知道是否可以将谷歌分析添加到电子邮件中。 我想检查我发送的邮件的点击率、打开率。我对此做了一些研究,我了解到有一个跟踪代码...

回答 6 投票 0

分析中心报告 pdf 导出不起作用

我正在尝试从分析中心将报告导出为 pdf,它说正在加载..但实际上什么也没发生。我尝试过使用其他格式导出,似乎效果很好。 有没有人...

回答 2 投票 0

如何将Google Analytics标签添加到使用Streamlit开发的网站?

我想在 Google Analytics 中跟踪我使用 Streamlit 构建的 UI。 根据 Google Analytics,需要将以下内容添加到 HTML 的 部分。 <question vote="4"> <p>我想在 Google Analytics 中跟踪我使用 Streamlit 构建的 UI。 根据 Google Analytics,需要将以下内容添加到 HTML 的 <head> 部分。</p> <pre><code>&lt;script async src=&#34;https://www.googletagmanager.com/gtag/js?id=G-**********&#34;&gt;&lt;/script&gt; &lt;script&gt; window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(&#39;js&#39;, new Date()); gtag(&#39;config&#39;, &#39;G-**********&#39;); &lt;/script&gt; </code></pre> <p>由于我的代码架构中没有任何 html 文件,因此我在主 .py 文件中包含以下 Streamlit 行:</p> <pre><code>google_analytics_js = &#39;[previous_html_code]&#39; st.components.v1.html(google_analytics_js) </code></pre> <p>不幸的是,该网站没有被跟踪。对此的任何帮助将不胜感激。</p> </question> <answer tick="false" vote="0"> <p>由于组件 HTML 将添加到 iframe,因此您需要允许其脚本访问父级:</p> <pre><code>&lt;script crossorigin=&#39;anonymous&#39;&gt; add script &lt;/script&gt; </code></pre> <p>除此之外,每当脚本访问 <pre><code>window</code></pre> 或 <pre><code>document</code></pre> 时,您都应该使用 <pre><code>parent.window</code></pre> 和 <pre><code>parent.document</code></pre>。</p> </answer> <answer tick="false" vote="0"> <p>不幸的是,Streamlit 不支持自定义头元素,但有一个技巧可以将自定义内容(如 Google Analytics 或元标记)注入到 Streamlit 包中的 <pre><code>index.html</code></pre> 文件中。</p> <p>我从我的 docker 中调用这个脚本 <pre><code>entrypoint.sh</code></pre>,因此它在应用程序启动时运行。</p> <p>您可以读取一个文件来注入您自己的内容 - (我正在使用一个名为 <pre><code>head.html</code></pre> 的文件)</p> <pre><code># Customize the built-in index.html page in the Streamlite app import os import streamlit import logging from sys import stdout logging.basicConfig(level=logging.DEBUG, stream=stdout) log = logging.getLogger(__name__) # setup a logger for some sanity # Get the path to the streamlit package streamlit_package_dir = os.path.dirname(streamlit.__file__) log.debug(f&#34;streamlit package dir: {streamlit_package_dir}&#34;) index_path = os.path.join(streamlit_package_dir, &#34;static&#34;, &#34;index.html&#34;) # head content file in the same directory as this script head_content_path = os.path.join(os.path.dirname(__file__), &#34;head.html&#34;) def _customize_index_html(): with open(index_path, &#34;r&#34;) as f: index_html = f.read() with open(head_content_path, &#34;r&#34;) as f: head_content = f.read() # Add the custom content to the head index_html = index_html.replace(&#34;&lt;/head&gt;&#34;, f&#34;{head_content}&lt;/head&gt;&#34;) # Replace the &lt;title&gt; tag index_html = index_html.replace( &#34;&lt;title&gt;Streamlit&lt;/title&gt;&#34;, &#34;&lt;title&gt;Savantly is cool&lt;/title&gt;&#34; ) with open(index_path, &#34;w&#34;) as f: f.write(index_html) _customize_index_html() </code></pre> </answer> </body></html>

回答 0 投票 0

Google Analytics 服务 Intent 在 Android Oreo 上崩溃

我已升级我的应用程序以支持 SDK 26,现在 Google Analytics 在 Android Oreo 上运行时会导致崩溃: 致命异常:java.lang.RuntimeException:无法启动接收器 com.google.

回答 3 投票 0

来自第三方脚本的 Google Analytics

我正在开发一个小部件,可以通过js代码片段添加到主机网站,一旦渲染,就会将iframe添加到主机网站。 现在我的客户想给我他们的 GA 跟踪 ID,所以

回答 1 投票 0

Qualtrics 嵌入由 iFrame 为 GA 读取

感谢您查看此内容。 我手头的任务是把一个html页面放在qualtrics中,作为一个iframe(是目前的想法),然后看看我是否可以通过事件跟踪来获取用户数据

回答 1 投票 0

如何使用 Google Analytics 4 跟踪用户对未托管在服务器上的文件的参与度?

是否有解决方法可以在 Google Analytics 4 中禁用协议检查来跟踪用户对基于文件的应用程序(如 webOS 应用程序)的参与度,因为 GA4 不再提供禁用 i...

回答 1 投票 0

如何使用谷歌分析将单个用户的国家/地区保存到数据库中?

在带有 PostGres 数据库的 Flask Web 应用程序中,我想在用户注册并将其保存到数据库时获取用户的国家/地区。我正在尝试使用 google Analytics/GA api 来做到这一点...

回答 1 投票 0

如何允许客户在任何域上输入自己的 google anlytics 跟踪/测量 ID?

考虑一个为用户提供登陆页面的 SAAS 提供商。这些页面托管在提供商的域下: https://landingpagesinc.com/myname 现在让我们考虑提供商希望允许用户添加

回答 1 投票 0

从 Hubspot 联系人的电子邮件字段获取用户的电子邮件

在我的 WordPress 网站上,我在 Hubspot 中内置了一个联系表单。我从 Hubspot 获取了此表单的脚本,并将其粘贴到我的联系页面 (https://stagezero.ai/contact/) 中。 hbspt.forms.</desc> <question vote="0"> <p>在我的 WordPress 网站上,我在 Hubspot 中内置了一个联系表单。我从 Hubspot 获取了此表单的脚本,并将其粘贴到我的联系页面 (<a href="https://stagezero.ai/contact/" rel="nofollow noreferrer">https://stagezero.ai/contact/</a>)。</p> <pre><code>&lt;script&gt; hbspt.forms.create({ region: &#34;na1&#34;, portalId: &#34;20085053&#34;, formId: &#34;412d2c51-95f1-4a6c-b3f3-f71c5852ac98&#34; }); &lt;/script&gt; </code></pre> <p>每当提交表单时,用户都会被重定向到我们的感谢页面(<a href="https://stagezero.ai/thank-you/" rel="nofollow noreferrer">https://stagezero.ai/thank-you/</a>)。 因此,每当有人提交表单时,我想从我们联系人的电子邮件字段中提取用户的电子邮件。基本上,目标是将电子邮件存储为变量,以便可以对其进行哈希处理并将其发送到谷歌分析。 我尝试自己通过编写此代码并将其粘贴到我的联系页面中来完成此操作,但不幸的是它不起作用。有人可以帮助我实现我上面提到的目标吗? <strong>谢谢你</strong>。</p> <pre><code>&lt;script&gt; //code to get email values from contact form’s email field var form = document.getElementById(&#34;hsForm_412d2c51-95f1-4a6c-b3f3-f71c5852ac98&#34;); var email_field=document.getElementById(&#34;email-412d2c51-95f1-4a6c-b3f3-f71c5852ac98&#34;); form.onsubmit = function(){ var email = email_field.value(); //code to send email values to Google Analytics dataLayer.push({ &#39;event&#39;:&#39;form_submit&#39;, &#39;enhanced_conversion_data&#39;: { &#34;email&#34;: email // replace &#39;yourEmailVariable&#39; with email variable // } }); }; &lt;/script&gt; </code></pre> </question> <answer tick="false" vote="0"> <p>@BNazaruk 是正确的,因为它是一个 iframe,您将无法使用元素选择器检索该数据。然而,Hubspot 使用消息传递作为其内部工具,因此没有记录,但通过一些广泛的日志记录,我找到了如何检索该电子邮件数据。</p> <pre><code>&lt;script&gt; //listen for the message event window.addEventListener(&#34;message&#34;, function(event) { //log the message data so you can see what hubspot is saying console.log(event.data); //detect the submission event if(event.data.type === &#39;hsFormCallback&#39; &amp;&amp; event.data.eventName === &#34;onFormSubmit&#34;) { const email = event.data.submissionValues.email; //submissionValues will list out your form data so make sure to see what your exact key is for the email field. //code to send email values to Google Analytics dataLayer.push({ &#39;event&#39;:&#39;form_submit&#39;, &#39;enhanced_conversion_data&#39;: { &#34;email&#34;: email } }); } }); &lt;/script&gt; </code></pre> </answer> </body></html>

回答 0 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.