Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cemba

    (@cemba)

    mc4wp.forms.on(‘submitted’, function(form) { } if i use this function it ll work after page reload not onclick, i cant get input value correct. how can i disable pagereload.

    Thread Starter cemba

    (@cemba)

    do you see the console log(datalayer) in your browser console?
    Yes i see datalayer on console log but empty array

    any JS error in the browser console?
    no jserror

    do you use dataLayer.push on other places in your site, and it works there?
    yep i used it for multiple trigger form and it worked.

    used this function type for other forms;

    function dtGelisim(){
      var statuse = document.querySelectorAll("#statusId li.active a span")[0].innerText;
      
        var today = new Date();
        var selectedday = new Date(document.getElementsByName("BDAY")[0].value);
        var oneDay = 24 * 60 * 60 * 1000;
        var diffDays = Math.round(Math.abs((selectedday - today) / oneDay));
        
        dataLayer.push({
        'event': 'FormSubmit',
        'MainCategory': 'xx',
        'SubCategory': 'xx',
        'Status': statuse,
        'RemainingDay': diffDays,
        'Kvkk': 'Yes'
        });
        console.log(dataLayer);
     }
Viewing 2 replies - 1 through 2 (of 2 total)