让GTM代码在Web应用程序上工作 [英] Getting GTM code working on web application

查看:125
本文介绍了让GTM代码在Web应用程序上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们公司为我们的职业/工作网站使用第三方服务,允许用户提交求职信息。最初,用户登陆一个与GTM很好地集成的面向外部的平台。在CMS中,您可以轻松地将GTM代码添加到标题和正文区域。但是,一旦用户在工作描述上点击应用,他们就会被重定向到一个Web应用程序,这本质上是一个单独的系统。不幸的是,这第二个系统不允许你添加代码到页眉或页脚。不过,我可以将代码添加到用户在提交申请时看到的谢谢页面。

Our company uses a third party service for our career/job site, allowing users to submit applications for job postings. Initially, users land on an external facing platform which integrates nicely with GTM. Within the CMS, you can easily add GTM code to the header and body area. However, once a user clicks 'apply' on a job description, they're redirected to a web application, which is essentially a separate system. Unfortunately, this second system does not allow you to add code to the header or footer. I am, however, able to add code to the "thank you" page which users see when they submit an application.

在谢谢页面上,唯一的插入GTM代码的方法是使用所见即所得。您不能将代码插入到< head> 中,但您可以将其插入到< body> 中。我知道这并不理想,但它是唯一的选择。

On the "thank you" page, the only way to insert the GTM code is using a WYSIWYG. You cannot insert the code into the <head>, but you can insert it into the <body>. I know it's not ideal, but it's the only option.

尽管我可以让代码在页面上呈现,但它根本不起作用。它不会记录综合浏览量,Google Tag Assistant没有看到代码,并且当GTM容器处于预览模式时,Google GTM工具栏不会显示。

Even though I can get the code to render on the page, it's not working at all. It's not recording pageviews, Google Tag Assistant doesn't see the code, and Google's GTM toolbar doesn't show up when the GTM container is in preview mode.

我可以告诉,当用户提交应用程序时,页面不会刷新。因此,我假设这是标签不工作的原因。我尝试过使用许多不同的触发器,基于我在线阅读的建议,但没有一个能解决问题。

From what I can tell, the page does not refresh when a user submits an application. Thus, I'm assuming that is the reason why the tag is not working. I've tried using a number of different triggers, based on advice I've read online, but none have solved the issue.

我只是使用标准的GTM代码,但我会在下面发布我的代码:

I'm just using the standard GTM code, but I'll post my code below anyways:

    <!-- 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','###');</script>
<!-- End Google Tag Manager -->

注意:我也利用 < script> 代码之后的< noscript> 代码。

NOTE: I'm also utilizing the <noscript> code immediately after the <script> code.

推荐答案

这是一种非常常见的安全措施,允许用户在网页上添加内容,而不是GTM,您可以添加攻击服务器或在页面上放置比特币矿工的东西。

This is a very common security measure on sites that allow users to add content to pages, as instead of GTM you could add something that attacks their server or place a bitcoin miner on the page.

https://en.wikipedia.org/wiki/Code_injection

您唯一的解决方法是要求您的提供商直接支持GTM,或者如果您幸运的话可以找到< noscript> 版本可以工作,这可能足以满足您的要求。

Your only solutions to this is to ask your provider to support GTM directly, or if your lucky you may find the <noscript> version does work and that might be enough to meet your requirement.

这篇关于让GTM代码在Web应用程序上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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