简体   繁体   English

Google跟踪代码管理器下拉跟踪不起作用

[英]Google Tag Manager drop down tracking not working

I have return below code for drop down tracking. 我已经返回以下代码进行下拉跟踪。 It is working fine on fire fox but not in chrome browser.Data to fire only when drop down text is selected 它在Firefox上可以正常工作,但在chrome浏览器中不能正常工作。仅当选择下拉文本时才能触发数据

          jQuery("body").on("click",'#selectoption    option[value=option1]').click(function(){

try {
    var label = "";
        dataLayer.push({
        'event': 'error-click',
        'category': 'text1',
        'action': 'text2',
        'label': 'text3'});
} catch (err) {}

}); });

jQuery("body").on("click",'#selectoption option[value=option2]').click(function(){ jQuery(“ body”)。on(“ click”,'#selectoption option [value = option2]')。click(function(){

try {
    var label = "";
        dataLayer.push({
        'event': 'error-click',
        'category': 'text4',
        'action': 'text5',
        'label': 'text6'});
} catch (err) {}

}); });

below code snapshot 下面的代码快照 在此处输入图片说明

I have use below code for chrome but is firing twice in chrome and not working in firefox 我在Chrome中使用了以下代码,但在Chrome中触发了两次,但在Firefox中无法正常工作

jQuery('#selectoption').change(function () {

try {
    var label = "";
        dataLayer.push({
        'event': 'error-click',
        'category': 'text4',
        'action': 'text5',
        'label': 'text6'});
} catch (err) {}

}); });

Can any assist with right code Thanks in advance. 可以提供正确代码的任何帮助,谢谢。

Below code worked fine with my implementation in both of the browser 下面的代码可以很好地在两个浏览器中实现

jQuery('#selectoption').change(function () {
    try {
        var label = "";
        dataLayer.push({
          'event': 'error-click',
          'category': 'text4',
          'action': 'text5',
          'label': 'text6'});
    } catch (err) {}
});

There may be some other issue. 可能还有其他问题。 Have any clicks bind through GTM? 是否有通过GTM绑定的点击?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM