-
AuthorPosts
-
June 1, 2015 at 11:12 am #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!
June 2, 2015 at 6:47 am #452930Hi 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,
RikardJune 2, 2015 at 10:47 am #453057This reply has been marked as private.June 3, 2015 at 7:39 am #453578Hey!
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,
RikardJune 4, 2015 at 12:04 pm #454391Hi 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!
June 4, 2015 at 2:41 pm #454486Hi!
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!
YigitJune 5, 2015 at 1:16 pm #455072Hey Yigit!
Thanks, let me try it and I’ll tell you something.
June 5, 2015 at 2:53 pm #455101Hey!
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,
YigitJune 10, 2015 at 12:50 pm #457155Hi 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.
-
AuthorPosts
- The topic ‘jQuery script not working in single page’ is closed to new replies.