简体   繁体   English

Google跟踪代码管理器表单-谢谢页面

[英]Google Tag Manager Form - Thank You Page

I am trying to use google tag manager to have a tag that will fire every time the user submits the form and lands on the thank you page. 我正在尝试使用Google标记管理器来创建一个标记,该标记将在用户每次提交表单并到达“谢谢”页面时触发。 In this scenario, I know an option is to use the Trigger: Page View, and then specify the thank you page URL in the conditional statement. 在这种情况下,我知道一个选择是使用“触发器:页面视图”,然后在条件语句中指定“谢谢页面” URL。

However, since this URL can be shared, I only want to track when the user submits the form and lands on the thank you page (not when the URL is accessed through other ways). 但是,由于可以共享此URL,所以我只想跟踪用户何时提交表单并到达“谢谢”页面(而不是何时通过其他方式访问URL)。 What would be the best way to tackle this? 解决这个问题的最佳方法是什么?

Why would people share the thank-you page? 人们为什么要分享感谢页面? I can imagine sharing a form, but why would the url of the Thank you page get shared. 我可以想象共享一个表单,但是为什么要共享“谢谢”页面的网址。

However, what you can do is track clicks on the button or link that submits the form. 但是,您可以做的是跟踪提交表单的按钮或链接上的单击。

I ll advise assuming you NEED to fire when the user gets to the ThankYou Page for X reason and CANT be done on the button submit click. 我会建议假设您需要在用户出于X原因而进入ThankYou Page时触发,并且不能在提交提交按钮上完成。 Add a custom HTML tag with a trigger on the click of the form submit button (you can use build in variables such as Click Classes) and add a 'flag' on the session storage or a cookie (choose the one you are more comfortable with). 单击表单提交按钮时添加带有触发器的自定义HTML标记(您可以使用内置变量(如Click Classes)),并在会话存储或cookie中添加“标志”(选择您更喜欢的标记) )。 Then generate a trigger that fires on the Thankyou page AND has the flag on. 然后生成一个触发器,在“谢谢”页面上触发并打开该标志。

Example: 例:

Tag when user submit the form: 用户提交表单时标记:

<script>
storage.setItem('flagSubmit', 1);
</script>

Custom JS variable that checks if user has flag: 自定义JS变量,用于检查用户是否具有标志:

function(){
    return storage.getItem('flagSubmit');
}

If you need any more help just ask. 如果您需要更多帮助,请询问。 Hope it helps! 希望能帮助到你!

-- EDIT: add info -编辑:添加信息

As you comment you cant detect if the flag is being saved properly so here is a code you can paste on the console that ll avoid you browser to exiting the page and allowing you to see if your click tag worked and registered on session storage you data. 当您发表评论时,您无法检测到该标志是否已正确保存,因此可以在控制台上粘贴以下代码,以免浏览器退出页面并允许您查看click标记是否在会话存储中正常工作并注册了数据。

window.addEventListener("beforeunload", function() { debugger; }, false)

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

相关问题 PayPal 谢谢页面按表单变量 - PayPal Thank You Page by form variable HTML 使用 Apps 脚本登陆“谢谢”页面向 Google 表格提交表单 - HTML Form Submission to Google Sheets using Apps Scripts Landing "Thank You" Page 如何在没有单独的感谢页面的情况下设置联系表单的Google Analytics(分析)目标跟踪? - How to set up Google Analytics goal tracking of a contact form with no separate thank you page? Google跟踪代码管理器导致页面表单提交两次 - Google Tag Manager causing page form to submit twice 提交表单后直接对“谢谢”页面做出反应 - React direct to a "thank you" page after submitting a form 在注册表格中张贴提交的姓名,以感谢您的页面 - Post the name submitted in a sign up form to thank you page 如何提交表格,然后重定向到个性化的“谢谢”页面? - How to submit a form and then redirect to a personalized thank you page? HTML表单提交到数据库并重定向到“谢谢”页面 - HTML form Submission to Database and redirect to Thank you page 如何重定向选择加入表格以感谢页面? - How to redirect opt-in form to thank you page? 联系表格 7 感谢您在新 window 上重定向页面 - Contact form 7 thank you page redirection on new window
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM