Google Analytics(分析)是Google提供的免费网络分析解决方案,具有多个客户端API,以及用于数据导出和管理的REST API。
我需要跟踪客户在多个域、高级流程上的行为: 客户访问brandA.com 客户被重定向到brandB.com以完成他们的操作 客户重定向回胸罩...
我用它来进行谷歌分析, <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><noscript> <iframe src="//www.googletagmanager.com/ns.html?id=GTM-KCQGLT" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> </code></pre> <p>还有这个</p> <pre><code><script>(function(w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);})(window, document, 'script', 'dataLayer', 'GTM-KCQGLT');</script> </code></pre> <p>当我在本地主机中运行此代码时,我可以禁用此脚本吗?</p> </question> <answer tick="true" vote="58"> <p>使用下面的代码。</p> <pre><code><script> var host = window.location.hostname; if(host != "localhost") { // your google analytic code here } </script> </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['ga-disable-UA-XXXXX-Y'] = 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['ga-disable-UA-XXXXX-Y'] = 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>
GA4 - 测量协议问题 - gtag + client_id + session_id 未合并到报告中
我们已将 UA 迁移到 GA4。我们使用 gtag.js 进行网站上的大多数活动,并使用测量协议进行购买。 我们注意到测量协议事件有问题
GA4 谷歌分析。 gtag.js 延迟几秒发送请求,而不是立即发送
问题是向 Google https://www.google-analytics.com/g/collect 发出的请求?不是立即发送,而是在 3-4 秒后发送。我在谷歌的官方文档中寻找解决方案......
我正在为一个新网站设置分析。我看过很多文章/参考资料,详细介绍了如何使用 Google 跟踪代码管理器设置分析。我还看过使用react-ga或react-ga的文章...
目前是否可以在 GA4 中的产品级别添加自定义维度,以便将其用于报告? 例如,如果我发送如下所示的数据: 事件:“购买”, 值:500,
Google 分析和 iframe 内容 - 所有跟踪都有效吗?
我在这里看到了很多关于谷歌分析跟踪和 iframe 以及如何可能出现一些问题的帖子。也看到了这个:https://developers.google.com/analytics/devguides/collection/...
尝试了解使用自定义标签和变量的高级 Google 跟踪代码管理器设置
我是一名营销专业人士,一直为客户进行基本的标记和分析。我遇到过一个由具有丰富开发/分析知识的人建立的帐户,我很挣扎......
我正在将我的项目从Universal Analytics 更新到GA4,但遇到了很多问题。我正在尝试安装 ga-gtag 模块,以便能够使用新格式发送我的事件...
当您通过运行创建analytics.js的新实例时 ga('创建', 'UA-XXXXXXX-Y', {'cookieDomain': '无'}); GA 创建一个唯一的客户端 ID。 我想获取这个 ID 并将其用于我自己的
我想知道是否可以将谷歌分析添加到电子邮件中。 我想检查我发送的邮件的点击率、打开率。我对此做了一些研究,我了解到有一个跟踪代码...
我正在尝试从分析中心将报告导出为 pdf,它说正在加载..但实际上什么也没发生。我尝试过使用其他格式导出,似乎效果很好。 有没有人...
如何将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><script async src="https://www.googletagmanager.com/gtag/js?id=G-**********"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-**********'); </script> </code></pre> <p>由于我的代码架构中没有任何 html 文件,因此我在主 .py 文件中包含以下 Streamlit 行:</p> <pre><code>google_analytics_js = '[previous_html_code]' st.components.v1.html(google_analytics_js) </code></pre> <p>不幸的是,该网站没有被跟踪。对此的任何帮助将不胜感激。</p> </question> <answer tick="false" vote="0"> <p>由于组件 HTML 将添加到 iframe,因此您需要允许其脚本访问父级:</p> <pre><code><script crossorigin='anonymous'> add script </script> </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"streamlit package dir: {streamlit_package_dir}") index_path = os.path.join(streamlit_package_dir, "static", "index.html") # head content file in the same directory as this script head_content_path = os.path.join(os.path.dirname(__file__), "head.html") def _customize_index_html(): with open(index_path, "r") as f: index_html = f.read() with open(head_content_path, "r") as f: head_content = f.read() # Add the custom content to the head index_html = index_html.replace("</head>", f"{head_content}</head>") # Replace the <title> tag index_html = index_html.replace( "<title>Streamlit</title>", "<title>Savantly is cool</title>" ) with open(index_path, "w") as f: f.write(index_html) _customize_index_html() </code></pre> </answer> </body></html>
Google Analytics 服务 Intent 在 Android Oreo 上崩溃
我已升级我的应用程序以支持 SDK 26,现在 Google Analytics 在 Android Oreo 上运行时会导致崩溃: 致命异常:java.lang.RuntimeException:无法启动接收器 com.google.
我正在开发一个小部件,可以通过js代码片段添加到主机网站,一旦渲染,就会将iframe添加到主机网站。 现在我的客户想给我他们的 GA 跟踪 ID,所以
感谢您查看此内容。 我手头的任务是把一个html页面放在qualtrics中,作为一个iframe(是目前的想法),然后看看我是否可以通过事件跟踪来获取用户数据
如何使用 Google Analytics 4 跟踪用户对未托管在服务器上的文件的参与度?
是否有解决方法可以在 Google Analytics 4 中禁用协议检查来跟踪用户对基于文件的应用程序(如 webOS 应用程序)的参与度,因为 GA4 不再提供禁用 i...
在带有 PostGres 数据库的 Flask Web 应用程序中,我想在用户注册并将其保存到数据库时获取用户的国家/地区。我正在尝试使用 google Analytics/GA api 来做到这一点...
如何允许客户在任何域上输入自己的 google anlytics 跟踪/测量 ID?
考虑一个为用户提供登陆页面的 SAAS 提供商。这些页面托管在提供商的域下: https://landingpagesinc.com/myname 现在让我们考虑提供商希望允许用户添加
在我的 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><script> hbspt.forms.create({ region: "na1", portalId: "20085053", formId: "412d2c51-95f1-4a6c-b3f3-f71c5852ac98" }); </script> </code></pre> <p>每当提交表单时,用户都会被重定向到我们的感谢页面(<a href="https://stagezero.ai/thank-you/" rel="nofollow noreferrer">https://stagezero.ai/thank-you/</a>)。 因此,每当有人提交表单时,我想从我们联系人的电子邮件字段中提取用户的电子邮件。基本上,目标是将电子邮件存储为变量,以便可以对其进行哈希处理并将其发送到谷歌分析。 我尝试自己通过编写此代码并将其粘贴到我的联系页面中来完成此操作,但不幸的是它不起作用。有人可以帮助我实现我上面提到的目标吗? <strong>谢谢你</strong>。</p> <pre><code><script> //code to get email values from contact form’s email field var form = document.getElementById("hsForm_412d2c51-95f1-4a6c-b3f3-f71c5852ac98"); var email_field=document.getElementById("email-412d2c51-95f1-4a6c-b3f3-f71c5852ac98"); form.onsubmit = function(){ var email = email_field.value(); //code to send email values to Google Analytics dataLayer.push({ 'event':'form_submit', 'enhanced_conversion_data': { "email": email // replace 'yourEmailVariable' with email variable // } }); }; </script> </code></pre> </question> <answer tick="false" vote="0"> <p>@BNazaruk 是正确的,因为它是一个 iframe,您将无法使用元素选择器检索该数据。然而,Hubspot 使用消息传递作为其内部工具,因此没有记录,但通过一些广泛的日志记录,我找到了如何检索该电子邮件数据。</p> <pre><code><script> //listen for the message event window.addEventListener("message", 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 === 'hsFormCallback' && event.data.eventName === "onFormSubmit") { 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({ 'event':'form_submit', 'enhanced_conversion_data': { "email": email } }); } }); </script> </code></pre> </answer> </body></html>