Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #452465

    Hi guys,

    I’m trying to implement the following script in a single page (I write the page as a private content):

    (function($) { 
    $(document).ready(function() { 
    	$(':input').blur(function () { 
    	      if($(this).val().length > 0) { 
                        dataLayer.push({'event':'abandformcomplet','eventLabel': this.name});
    	      } 
    	      else { 
                        dataLayer.push({'event':'abandformincomplet','eventLabel': this.name});
    	}); 
    }); 
    })(jQuery);

    To do that, I just add a code block into the page and I paste the previous code between <script></script> tags.
    My analytics guy tells me that it’s not working and I wanted to ask you guys if there could be a wrong implementation from my side. Maybe this type of code is not accepted in the code block?

    Thanks!

    #452930

    Hi blancocapell!

    Could you please provide us with a temporary admin login so that we can take a closer look? You can post the details here as a private reply.

    Regards,
    Rikard

    #453057
    This reply has been marked as private.
    #453578

    Hey!

    I’m not sure what the code is supposed to do but I think it has something to do with the form, correct? If so, you should probably try to load the code block before the form?

    Regards,
    Rikard

    #454391

    Hi Rikard,

    Yes, it has something to do with the form. More specifically, this tracks when the user is leaving the form, so we can track better what’s “not working” in our form.
    OK, I will try your suggestion. This means I simply have to drag and drop the ‘Code Block’ above the the form, right?

    Thanks!

    #454486

    Hi!

    Yes, you can simply drag and drop a Code Block element and add your code inside it. Please make sure to wrap your code inside Script tags as well – http://www.w3schools.com/tags/tag_script.asp

    Cheers!
    Yigit

    #455072

    Hey Yigit!

    Thanks, let me try it and I’ll tell you something.

    #455101

    Hey!

    Sure, we will be waiting to hear from you. Please try and let us know so we can mark the thread as resolved or assist you further :)

    Regards,
    Yigit

    #457155

    Hi guys,

    In the end it didn’t work. I think there is something wrong in the code. Unless you have any other suggestion, I will give up on this, don’t worry.

    Thanks anyway for your help.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘jQuery script not working in single page’ is closed to new replies.