简体   繁体   English

使用服务器端容器从 Google 标签管理器调用脚本

[英]Calling a script from Google Tag Manager using a Server-Side container

I have an existing GTM container that works fine calling my existing script:我有一个现有的 GTM 容器,可以很好地调用我现有的脚本:

<script type="text/javascript" src="//myserver.com/td/loader.js"></script>

I want to now execute this exact code using the new Server-Side container in GTM: I have successfully set up a Server-Side container, and can even call it from my page, and see the pageview events successfully.我现在想在 GTM 中使用新的服务器端容器执行这个确切的代码:我已经成功设置了一个服务器端容器,甚至可以从我的页面调用它,并成功查看页面浏览事件。

I have set up an HTTP Request tag in this container and pointed it at the functional URL: https://myserver.com/td/loader.js我在这个容器中设置了一个 HTTP 请求标签,并将它指向功能 URL: https : //myserver.com/td/loader.js

Under "Preview" in GTM, I can see that the HTTP request is being made, but the JavaScript returned never executes.在 GTM 中的“预览”下,我可以看到正在发出 HTTP 请求,但返回的 JavaScript 从未执行。

My question is: What do I have to do to get javascript to execute from a Server-Side container the way it does coming from a regular container executing directly on the page.我的问题是:我该怎么做才能让 javascript 从服务器端容器执行,就像它从直接在页面上执行的常规容器一样。 The call gets made server-side, but nothing is done with the returned javascript.调用在服务器端进行,但返回的 javascript 没有做任何事情。

I suggest you take a look at the following article: https://www.simoahava.com/analytics/custom-templates-guide-for-google-tag-manager/我建议你看看下面的文章: https : //www.simoahava.com/analytics/custom-templates-guide-for-google-tag-manager/

You can import your own custom template and you will have to write code to be able to read your own js.您可以导入自己的自定义模板,并且必须编写代码才能读取自己的 js。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google跟踪代码管理器和优化服务器端实验发送变体 - Google Tag Manager & Optimize Server-Side experiment sending variation 调用Google Visualization API服务器端 - Calling Google Visualization API Server-Side 在侧边栏GAS中调用服务器端脚本 - Calling server-side script within a sidebar GAS 通过从客户端代码调用服务器端代码来修改UpdatePanel - Modify an UpdatePanel by calling server-side code from client code 仅使用服务器端脚本(无浏览器)解释Javascript代码 - Interpreting Javascript code using only a server-side script (no browser) 使用服务器端脚本过滤HTML输入元素的内容 - Filtering contents of an HTML input element using a server-side script 使用require()转换服务器端/ PhantomJS的JS脚本 - Converting JS script for server-side/PhantomJS using require() Google跟踪代码管理器-容器中没有代码 - Google Tag Manager - There are no Tags in the container 从客户端(Node.js)的服务器端调用函数 - Calling a function from server-side on the client-side (Node.js) 如何使用AngularJS从服务器端获取数组? - How to GET an array from server-side using AngularJS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM