点击<a>

时间:2016-05-06 16:36:28

标签: javascript html google-tag-manager

I have a button:

<a href="#how-it-works" class="purple-button text-center">LEARN HOW <strong>BREATH<br>POWERED DELIVERY</strong> WORKS</a>

We are using google tag manager on this button and if we click any of the area that is inside the <strong> element, the GTM event does not fire. If I click anywhere else it is fine and the event is sent. Any ideas?

3 个答案:

答案 0 :(得分:1)

我明白了。强元素优先于锚元素,因此不会发射。设置.purple-button strong { pointer-events:none;}修复它。

请注意&lt; <{1}}不支持pointer-events IE10。所有其他浏览器似乎都支持它。

答案 1 :(得分:0)

将一个onclick处理程序添加到&#34; strong&#34;滚动到该锚点的元素。

答案 2 :(得分:0)

这通常是Google跟踪代码管理器的问题。如果您尝试在不编辑站点代码的情况下解决它,可以使用自定义JavaScript元素从父级读取属性,允许您设置类似于触发器的其余部分的触发器。

function() {
return {{Click Element}}.parentElement.href;
}