我正在尝试使用最新的dataLayer对象在 Google Analytics 中设置要触发的1 个点击事件,并将其设置为如下触发:
$('.vinyl-calc .calculate').click(function() {
// some code here...
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'calculatorClick',
'calculatorType': 'vinyl'
});
});
Run Code Online (Sandbox Code Playgroud)
和
$('.silane-calc .calculate').click(function() {
// some code here...
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'calculatorClick',
'calculatorType': 'silane'
});
});
Run Code Online (Sandbox Code Playgroud)
我在 Google Tag Manager 和名为“Tools and Calculators”的标签中正确创建了 dataLayer 变量calculatorType,其中添加了自定义事件,如下所示是通过 Google Tag Manager 触发的:
但是,进入 Google Analytics,即使在 Realtime 中也不会显示此处发生的任何事件。我在 Google Analytics 中根本看不到任何东西,而且在 Google Analytics 中似乎根本无法跟踪它。如何calculatorClick使用calculatorType变量在谷歌分析中显示事件???
我一直在这几个小时内尝试各种方法来使其正常工作,但没有任何工作正常。我遵循的一些在 Google Analytics …
我正在使用下面的代码片段通过设置“null”来清除 userid 和 userproperty 值,但该值在 GoogleAnalytics、Firebase 中得到保留。
FirebaseAnalytics.getInstance(context).setUserId(null);
FirebaseAnalytics.getInstance(context).setUserProperty("sessionId", null);
Run Code Online (Sandbox Code Playgroud)
如果用户登录和用户注销 userid 和 sessionid 值需要清除,则将设置 Userid 和 sessionid 值。
谁能帮我解决这个问题
谢谢,卡马尔
analytics google-analytics firebase google-tag-manager firebase-analytics
使用 Google 标签管理器,我想使用环境功能。虽然环境设置非常简单,但有一个关于 Live 环境设置的特殊情况。更具体地说,文档提到:
注意:默认情况下,每个容器都设置了一个“Live”环境,它始终指向当前发布的容器版本。您不需要定义 Live 环境。
现在,为了在我的网站上为 Live 设置 GTM,我有 2 个可能的片段:“默认”片段(可以通过管理 > 在我的容器中安装 Google 标签管理器获得)和“实时”片段(可以是通过管理>环境>“实时”>(操作)获取片段获得)。
这里的问题是第一个脚本似乎没有正确映射到 Live 环境,因为在查找表中使用它映射到默认值。
另一方面,第二个脚本似乎工作正常。我担心的是它使用了 2 个附加参数(gtm_auth和gtm_preview),我不确定是否应该将它们定义为 Live 环境。此外,一些博客建议在 Live 环境中使用第一个脚本。
我的问题 - 并且担心的是,就正确安装、使用和安全而言,这两个脚本中哪一个最适合用于在 GTM 中设置实时环境?
请考虑建议使用不同的容器不是一种选择。
我正在为已经有一些用于跟踪 Google Analytics 的代码的网站设置 Google Ads
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-XX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-XX');
</script>
<meta name="google-site-verification" content="................." />
Run Code Online (Sandbox Code Playgroud)
我需要将其设置为 Google Adwords 以进行一些电话验证。谷歌为此主题提供了以下代码:
<!-- Global site tag (gtag.js) - Google Ads: YYYYYYYYY -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-YYYYYYYYY"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-YYYYYYYYY');
</script>
<script>
gtag('config', 'AW-YYYYYYYYY/X_XXXXXXXXXXXXXXXXXX', {
'phone_conversion_number': '(XXX) XXX-XXXX'
});
</script>
Run Code Online (Sandbox Code Playgroud)
但我不知道如何组合这两个代码。
我试图粘贴这两个代码,但跟踪停止工作。
javascript google-analytics google-tag-manager google-ads-api
我在服务器的响应中添加了 Content-Security-Policy 标头,但是当 Google 标签管理器 (GTM) 注入自定义 HTML 标签时,浏览器会抛出错误。
CSP3 有“strict-dynamic”,它似乎是为 GTM 定制的,但目前只有 Chrome 支持它,而 CSP3 是一个工作草案。
我编写了代码来通过 GTM API 获取自定义 HTML 标签,希望我可以获取脚本的哈希值并将它们添加到标题中,但我发现 API 提供的 JavaScript 与 GTM 注入到 DOM 中的内容不匹配,因为 GTM 在注入脚本之前会缩小/混淆脚本。
现在我想知道是否有可能,只是可能,有一种方法可以告诉 GTM 向它注入的每个脚本添加一个随机数,但我找不到任何文档来支持这种希望/幻想。
有没有人遇到过这个问题,并找到了解决这个问题的方法?
(我不能像这里提到的那样从脚本中提取主机 -如何让 Google 标签管理器和内容安全策略共存? - 因为我们营销团队添加的自定义 HTML 标签是带有非空主体的标签,而不是只是带有源属性的标签,没有正文。)
我已经集成Firebase和GoogleTagManager使用的CocoaPods到我的iOS应用程序的目标。当我构建目标时,Xcode 不断给我错误:
Showing Recent Messages
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks
mkdir -p /Users/xxx.xxx/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks
/Users/xxx.xxx/Projects/MyApp/Applications/MyApp/Pods/Target Support Files/Pods-MyApp/Pods-MyApp-frameworks.sh: line 43: source: unbound variable
Command /bin/sh failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
我已经多次清理我的项目,删除了派生数据文件夹,但这些似乎都不起作用。
我的 Podfile 看起来像这样:
platform :ios, '11.0'
target 'MyApp' do
use_frameworks!
# Pods for MyApp
pod 'Firebase/Core', '~> 5.19'
pod 'Firebase/ABTesting'
pod 'Firebase/Performance'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Analytics'
pod 'GoogleTagManager', '~> 7.1'
end
Run Code Online (Sandbox Code Playgroud)
可可豆环境
CocoaPods : 1.5.3
Ruby : ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
RubyGems : 2.6.8
Host …Run Code Online (Sandbox Code Playgroud) 我刚刚gatsby-plugin-google-gtag在我的gatsby-config.js文件中安装了:
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: [
"UA-XXXXXXXXX-X", // Google Analytics / GA
"AW-XXXXXXXXX" // Google Ads / Adwords / AW
],
pluginConfig: {
head: true
},
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
然后我在我的表单上添加这个事件,它应该工作吗?
class Form extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
window.gtag("conversion", "click", { send_to: ["AW-XXXXXXXXX/-XXXXXXXXXXXXXXXX"]})
}
render() {
return (
<Div className='au'>
<form action="https://formspree.io/my@emailaddress.io" method="POST">
<InputName type="name" name="name" placeholder="Your Name"/>
<InputMail type="email" name="email" placeholder="Your …Run Code Online (Sandbox Code Playgroud) 我的vue.js项目有问题。我有一个函数,我必须在我的项目中添加它。当我添加index.html我的函数(它是在头项目中创建 tagManager 的函数)时,属性不起作用。所以我尝试在mounted(). 但是我仍然有一个问题,如何将它添加到 tempate。我的功能是:
<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 = "https://www.googletagmanager.com;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "dataLayer");
</script>
Run Code Online (Sandbox Code Playgroud)
我想我会将这个脚本设置为mounted,然后做document.head.appendChild。但是函数太复杂了,所以有问题。知道如何将此脚本添加到我的项目头部吗?
我正在使用 gatsby 和 gatsby-plugin-tag-manager,但无法触发自定义事件。我的 gatsby-config.js 看起来像这样:
{
resolve: `gatsby-plugin-google-tagmanager`,
options: {
id: 'GTM-XXXXXXX',
includeInDevelopment: true,
defaultDataLayer: function() {
return {
pageType: window.pageType,
// platform: 'gatsby',
}
},
},
Run Code Online (Sandbox Code Playgroud)
当我在本地运行所有内容时,我可以使用以下代码正确触发我的事件:
window.dataLayer.push({
event: 'gatsby-course-splash-sign-up',
})
Run Code Online (Sandbox Code Playgroud)
问题是,当我将其静态部署到 s3 存储桶而不是在服务器上运行时,当页面视图触发时,其他任何事情都没有。有谁知道如何让自定义触发器工作?谢谢!
对于我的网站,我已经有了 GA 和 GTM。增强型电子商务已启用。从下图可以看出。
我也试过下面的代码。
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<!-- Google Tag Manager -->
<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 =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-XXXXX');</script>
<!-- End Google Tag Manager -->
<!-- Google Tag Manager …Run Code Online (Sandbox Code Playgroud) html javascript google-analytics google-tag-manager enhanced-ecommerce