• thinkluke

    (@thinkluke)


    Using this code to track a submission, it has stopped working.

    	jQuery(document).bind("gform_confirmation_loaded", function (e, form_id) {
    		if(form_id == 6) {
    

    This the plugin compatibility with the native gform bind events?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter thinkluke

    (@thinkluke)

    Ahhh. its very ugly but i fixed it.

    jQuery(document).bind("gform_confirmation_loaded", function (e, form_id) {
    if(form_id != 1 || form_id != 2 || form_id != 3 || form_id != 4 || form_id != 5 || form_id != 7) {
    Thread Starter thinkluke

    (@thinkluke)

    no wait that doesnt work because all forms are now changed. argh

    Thread Starter thinkluke

    (@thinkluke)

    I tried again and still not working..

    var subid = jQuery('.hsubscribe').find('form').attr('id'),
    		subid = subid.replace('gform_',''),
    		sb_subscribe = jQuery('.hsubscribe').find('form').attr('id'),
    		sb_subscribe = sb_subscribe.replace('gform_','');
    		
    	console.log(subid + sb_subscribe);
    	
    	jQuery(document).bind("gform_confirmation_loaded", function (e, form_id) {
    		if(form_id == subid || form_id == sb_subscribe) {
    			console.log('works now');
    			Cookies.set('subscribe', 'subscribed', { expires: 365 });
    			ga('send', 'event', 'subscribed', 'subscribed to newsletter');
    			setTimeout(function(){
    				jQuery('.hsubscribe').slideUp();
    				fbq('trackCustom', 'Newsletter', {
    					content_name: 'Newsletter Signup',
    					content_category: 'Audience'
    				});
    			}, 2000);
    		}
    	});	
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Doesn’t work with jquery bind events to form’ is closed to new replies.