如何获得Google Analytics(分析)& Google标签管理器可以在嵌入IFRAME中的网站上工作?

发布于 2025-01-30 10:30:18 字数 484 浏览 4 评论 0原文

我正在尝试在我的网站上使用Google Analytics GA4和Google Tag Manager。

我的网站嵌入了另一个网站的iframe中。我看到当我浏览“网络”选项卡时,GTM已连接,但是我看不到我的标签在预期时会熄灭。当我从iframe内部删除网站时,我的标签是预期的。我正在使用窗口对象推到数据层。

推入数据层时,可以使用窗口对象在网站嵌入iframe中引起问题吗?当我的网站嵌入iframe中时,我该如何启动标签?

任何帮助或指导将不胜感激。感谢

我如何推向数据层:

window.dataLayer.push({
  event: "virtualPageview",
  pageName: "Page1",
  venueName: window.venueName,
  pageTitle: "Formyoula Page 1", //some arbitrary name for the page/state
});

I am trying to use Google Analytics GA4 and Google Tag Manager on my website.

My website is embedded in an Iframe inside another website. I see that GTM is connected when I look through the network tab but I do not see my tags firing off when expected. When I remove the website from within the Iframe my tags fire as expected. I am using the window object to push to the data layer.

Could using the window object when pushing to the data layer cause issues when the website is embedded in an Iframe? How can I have my tags fire off when my website is embedded in an Iframe?

Any help or guidance would be greatly appreciated. Thanks

How I am pushing to data layer:

window.dataLayer.push({
  event: "virtualPageview",
  pageName: "Page1",
  venueName: window.venueName,
  pageTitle: "Formyoula Page 1", //some arbitrary name for the page/state
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文