Google Tag Manager-是否有一种方法可以跟踪选择复选框,然后用户键入同一页面上的结帐按钮?
抱歉,如果这是一个愚蠢的问题。我是GTM菜鸟,通过谷歌搜索,我可以单独看到有关点击(复选框元素和结帐按钮)的教程,但想知道是否有任何办法在Google Analytics(分析)中可以是一个事件。
例如,在我们商店的购物车页面上,默认情况下选择了添加产品附件的复选框。我想知道有多少人键入结帐按钮,并保留检查的“添加配件”复选框。
有没有办法将事件推送为“结帐单击 - 添加复选框 - 选定”之类的东西?
提前致谢!
Sorry if this is a dumb question. I'm a GTM noob and from googling I see tutorials on tracking the clicks (checkbox element and Checkout button) separately but was wondering if there's any way this can be one Event in Google Analytics.
For example, on our store's cart page a checkbox to add a product's accessory is selected by default. I want to know how many people are hitting the Checkout button and leaving this "add an accessory" checkbox checked.
Is there a way to push an Event as something like "Checkout click - Add On Checkbox - Selected"?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以使用自定义的JavaScript变量检测任何事件的复选框,然后您可以在触发器中或在标签中使用其值。当然,或在不同的变量中。
如果您提供了复选框的HTML,则如果您不满意JS,我们可以为您提供变量的代码,以返回复选框状态。
// UPD
在您的代码中,您有一些错误。首先,无需在CJS变量中命名该函数。另外,您编写了太多的代码,而无需依靠jQuery。可以使用类似的纯J来更简单地求解:
现在,关于您所说的其余内容。
具有此复选框操作
。你有错误的理解。这不是复选框操作。只要使用此变量的值,此代码才会获得复选框的状态。因此,如果当一个人单击表单提交CTA时,您将使用此变量的值,则该代码将在该单击上运行,评估复选框的值。
您的亚马逊示例有效。但是您无需假设默认情况下检查复选框。默认值在这里并不意味着什么。复选框的状态在使用CJS var的值的位置上评估了触发器。
我们正在解决您的问题:
我对拥有多个标准(检查复选框并命中结帐按钮)感到困惑,并且如果将两者都包括在内,则触发器可以正常工作
您在这里犯了另一个错误。他们不是两个触发者。其中之一确实是触发器,这是一个点击触发器。但是,另一个是扳机发射的条件。您知道在扳机中如何单击“一些事件”的复选框?这个家伙:一旦拥有,就可以添加条件。就像,仅在...什么时候使用此触发器?真的。在我们的情况下,这将是复选框为true的时候。
最后,要进行结帐单击,通常不仅需要使用CSS选择器标准的单击触发器。
无论如何,简而言之,这是关于您的扳机的样子:

Yes, you can detect if a checkbox is checked on any event, using a Custom Javascript variable, value of which you then can use in the trigger, or in your tag. Or in a different variable, of course.
If you provide the html of your checkbox, we can give you code for the variable to return the checkbox state if you're not comfortable with JS.
//Upd
In your code, you have a few errors. First, no need to name the function in the CJS variable. Also, you write a bit too much code and rely on JQuery with no need. It can be solved simpler with pure JS like so:
Now, about the rest of what you're saying.
Having this checkbox action
. You have a wrong understanding. This is not a checkbox action. This code only gets the state of the checkbox whenever the value of this variable is being used.So if you're gonna use the value of this variable when a person clicks on the form submission CTA, then this code will run on that click, assessing the value of the checkbox.
Your amazon example works. But you don't need to assume that the checkbox is checked by default. The default doesn't mean anything here. The state of the checkbox is assessed on the trigger where the value of the CJS var is used, that's it.
We're proceeding with your question:
I'm confused about having the multiple criteria (checkbox is checked and user hits Checkout button) and if including both as triggers would work
You're making another mistake here. They're not both triggers. One of them is a trigger indeed, which is a click trigger. The other, however, is a condition for the trigger to fire. You know how in the trigger, you click the checkbox that says "some events"? This fella:Once you have that, you can add conditions. Like, only use this trigger when... when what? Anything really. In our case it would be when the checkbox is true.
Finally, for the checkout click, you don't typically need more than just the click trigger with the CSS selector criteria.
Anyhow, to be short, this is about how your trigger should look like:

谢谢!在这种情况下,我的购物车页面的复选框元素是:
我认为变量可能是:
但是,我感到困惑的地方是此复选框操作(检查复选框)仅在用户键入结帐按钮时将其视为事件。使用此 Amazon Cart Page 作为一个例子,假设是“假设”这是礼物“默认单击复选框,“这是一个礼物”复选框然后将触发器添加为具有两个标准,大致:
{{checkbox actiable}} =“ true”
&单击text =“继续进行结帐
?我对拥有多个标准感到困惑(检查了复选框,用户命令结帐按钮)以及在这种情况下都可以使用triggers,以便我可以看到如何查看多次用户在离开该框时单击购物车,或者单击“结帐”按钮需要是自己的单独变量,而不仅仅是在触发条件中指定结帐按钮名称?Thanks! In this case the checkbox element for my cart page is:
I was thinking the variable could be:
However where I get confused is having this checkbox action (checkbox is checked) only count as an event when the user hits the Checkout button. Using this Amazon cart page as an example, assuming the "This is a gift" checkbox is clicked by default, "This is a gift" checkbox would I just then add the Trigger as having two criteria, roughly:
{{Checkbox Variable}} = "true"
&Click Text = "Proceed to Checkout
? I'm confused about having the multiple criteria (checkbox is checked and user hits Checkout button) and if including both as triggers would work in this case so I can see how many times users click to checkout from the cart while leaving that box checked. Or would the Click on the Checkout button need to be it's own separate variable rather than just specifying the Checkout button name in the trigger criteria?