简体   繁体   English

Sweetalert 是否适用于 Google 跟踪代码管理器?

[英]Does Sweetalert work in Google Tag Manager?

I have been copying and pasting code from Sweetalert into Google Tag Manager.我一直在将代码从 Sweetalert 复制并粘贴到 Google 跟踪代码管理器中。 It doesn't appear at preview and after submit onto website it doesn't apper.它不会出现在预览中,提交到网站后也不会出现。 Does Sweetlart works in Google Tag Manager? Sweetlart 是否适用于 Google 跟踪代码管理器? (I'm very new to this) (我对此很陌生)

What I did:我做了什么:

  1. In custom HTML I put in sweetalert source code as one tag在自定义 HTML 中,我将 sweetalert 源代码作为一个标签

 <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>

and triggering: All page view.并触发:所有页面视图。 Tag firing options: Once per event代码触发选项:每个事件一次

  1. I put sweeralert pop up script in another tag我将 sweeralert 弹出脚本放在另一个标签中

 <script> swal.fire({ title: "Do you need any consultancy service?", text: "Let's", type: "info", confirmButtonColor: '#000000', confirmButtonClass: "contactMeNow_popUpButton", confirmButtonText: "Contact Me Now", closeOnConfirm: true, }); </script>

with Tag firing options: Once per event Tag Sequencing: Sweetalert source code (above) Triggering: All page load Window load.带有标签触发选项:每个事件一次标签排序:Sweetalert 源代码(上图)触发:所有页面加载 Window 加载。

  1. I have tried combine these two script in one tag but it also doesn't work.我试过将这两个脚本组合在一个标签中,但它也不起作用。

Does sweetalert works with Google Tag Manager? sweetalert 可以与 Google 跟踪代码管理器一起使用吗? Have I done something wrong in the script or in setting?我在脚本或设置中做错了什么吗?

Thank you so much for your reply in advance.非常感谢您提前回复。

  1. check the console error in chrome devtool .检查chrome devtool中的控制台错误。 There might be some error if this doesn't work.如果这不起作用,可能会出现一些错误。

  2. modify the code a bit to check the swal is exist稍微修改代码以检查swal是否存在

<script>
// try to console this variable is exist or not
console.log(typeof swal)
console.log(swal)

swal.fire({
 title: "Do you need any consultancy service?",
 text: "Let's",
 type: "info",
 confirmButtonColor: '#000000',
 confirmButtonClass: "contactMeNow_popUpButton",
 confirmButtonText: "Contact Me Now",
 closeOnConfirm: true,
});

</script>

The reason might be even if you fire the js tag earlier.原因可能是即使您更早触发 js 标记。 It can not guarantee the second tag will wail the js loading finished by the first tag.它不能保证第二个标签会在第一个标签完成的 js 加载时发出警告。

Tag 1 fired ----> Tag 2 fired ----> error触发标签 1 ----> 触发标签 2 ----> 错误

js start loading --------------> it might load finish in here js 开始加载 -------------- > 它可能会在这里加载完成

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

相关问题 Android 谷歌标签管理器不起作用 - Android Google Tag Manager does not work Google代码管理器 - 它是如何工作的? (建筑) - Google tag manager - how does it work? (Architecture) 自定义 HTML 代码如何在 Google 跟踪代码管理器中工作? - How does custom HTML code work in Google Tag Manager? Google Tag Manager 上的预览模式对我不起作用(超时) - Preview mode on Google Tag Manager does not work for me (timeout) Google跟踪代码管理器预览模式在Aurelia中不起作用 - Google Tag Manager Preview mode does not work in Aurelia Google跟踪代码管理器(Firebase)预览链接iOS不起作用 - 深层链接不包含有效的必需参数 - Google Tag Manager (Firebase) Preview link iOS does not work - Deep Link does not contain valid required params 这是否可以触发 Google 跟踪代码管理器中的 webhook? - Should this work to trigger a webhook in Google Tag Manager? Google 跟踪代码管理器能否在没有 GMS 的设备上运行? - Will Google Tag Manager work on devices without GMS? 无法在谷歌标签管理器中使用“if 语句” - Cant get “if statement” to work in in google tag manager Google跟踪代码管理器dataLayer是否公开PII? - Does Google Tag Manager dataLayer expose PII?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM