Hi All,
Please reference this post – https://kriesi.at/support/topic/ga-tracking-code-individual-forms/#post-518489
By replacing existing code in /framework/php/class-form-generator.php with the following – I can enable a avf_contact_form_attr filter.
$form_attr = apply_filters('avf_contact_form_attr', '', $this->formID, $this->form_params);
$this->output = '<form action="'.$params['action'].'" method="post" '.$form_data.' class="'.$form_class.' '.$extraClass.'" data-avia-form-id="'.$this->formID.'" '.$redirect.' '.$form_attr.'><fieldset>';
And if I follow the instructions here, theme updates will not overwrite the code changes – http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/
I can target ALL forms and insert GA script using your code suggestions for “onsubmit” – but I’d like to be able to target separate, individual forms and insert different GA script for those separate, individual forms.
I know I can use multiple “Thank You” pages as an error proof means of tracking form submittals – but that seems cumbersome.
I see that your shortcode script appends the Contact Form’s Custom CSS Class to the end of “form class=” in it’s HTML output.
If I could target that unique Custom CSS Class string in an “if” statement – that would be awesome.
Sadly, I’ve not been successful in targeting the Custom CSS Class string.
Thank you all for an amazing theme and the best support!
Mark
Hey bitsoul!
hm did you try to define a unique css class for your forms? turn on custom css class for al alb elements. I hope this will work for you!
Regards,
Andy