GTM-将事件/数据推送到GTM数据图层未将任何内容发送到https://www.google-analytics.com/r/collect?v [英] GTM - pushing events/data to gtm dataLayer not sending anything to https://www.google-analytics.com/r/collect?v

查看:590
本文介绍了GTM-将事件/数据推送到GTM数据图层未将任何内容发送到https://www.google-analytics.com/r/collect?v的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在chrome扩展页面中添加了该gtm代码(由iframe和iframe中的内容脚本注入)

I have added this gtm code in my chrome extension page(injected by the content script in and iframe)

// <!-- Google Tag Manager -->
(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','owDataLayer','GTM-XXXXXXX');
// <!-- End Google Tag Manager -->

我确认已成功加载gtm.js文件.

I confimred the gtm.js file loaded successfully.

Request URL:https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX&l=dataLayer
Request Method:GET
Status Code:200  (from disk cache)

我有一个按钮,并且按钮的click事件已附加以下代码

I have a button and below code has been attached to the click event of the button

dataLayer.push({
    'event': 'tab click',
    'user id' : 123,
    'description' : "Social"
});

当我单击按钮dataLayer.push成功时,但没有任何内容发送到https://www.google-analytics.com/r/collect? 开发人员工具栏窗口的网络"标签中没有任何活动.

When I click the button dataLayer.push worked with success but nothing is being sent to https://www.google-analytics.com/r/collect? no activities in the "Network" tab of developer toolbar window.

有人可以帮我解决这个问题吗?预先感谢!

Can anybody help me resolving this? Thanks in advance!

添加标签设置的屏幕截图.

Adding screenshot of the tag setup.

推荐答案

这个周末我花了很多时间阅读gtm和Google chrome扩展程序. 最后,我得到了 Simo Ahava的这篇博客文章.他讨论了与解决方案完全相同的问题.感谢Simo.

I have spent a lot of time this weekend on reading gtm and Google chrome extension. Finally I got this blog post by Simo Ahava. He discussing the exact same problem with solution. Thanks to Simo.

这是他的博客文章的部分粘贴.我们必须在每个gtm标签中添加checkProtocolTask : false以便从以下位置发送跟踪它们 Google Chrome扩展程序.

Here is partial paste of his blog post. We must add checkProtocolTask : false to each gtm tag in order to send track them from Google Chrome Extension.

在要设置的字段中添加checkProtocolTask : false

Add checkProtocolTask : false to Fields to Set

向下滚动到要设置的字段",然后添加一个新字段:

Scroll down to Fields to Set, and add a new field:

Field Name: checkProtocolTask
Value: false

通常,Google Analytics(分析)要求对GA的请求源自HTTP或HTTPS.如果请求来自其他任何地方,则该过程将被取消.通过将名为checkProtocolTask​​的任务设置为false,由于扩展程序使用了自定义的chrome-extension://协议,因此我们可以防止进行此检查.

Normally, Google Analytics requires that the request to GA originate from either HTTP or HTTPS. If the requests originate from anywhere else, the process is cancelled. By setting the task named checkProtocolTask to false, we can prevent this check from happening, since the extension uses the custom chrome-extension:// protocol.

屏幕截图:

发布此信息,以便其他人发现遇到相同问题的答案很有帮助.谢谢!

Posting this so others an find this answers helpful if they face same issues. Thanks!

这篇关于GTM-将事件/数据推送到GTM数据图层未将任何内容发送到https://www.google-analytics.com/r/collect?v的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆