Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #1234515

    Hi guys.
    I’m happy to use Enfold theme! Can you help me, please?

    I have three Contact Forms on my landing page and I want to track them by three different event category with Google Analytics.
    “NativeForm1_Sent” for first Contact Form
    “NativeForm2_Sent” for second Contact Form
    “NativeForm3_Sent” for third Contact Form

    Is it possible?
    I’ve found a similar topic here:
    But I’m not a coder :(( So I can’t adapt that code to solve my problem
    I’ll be happy if you could help me.

    Thank you


    4 days no answers :((
    May be the question is too complicated?

    Support is still needed



    Sorry for the delay. We can use the $formID parameter in the filter to check for the ID of the current contact form and apply the appropriate tracker.


    add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3);
    function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
      if($formID == 1) {
         $att = "onclick=\"_gaq.push(['_trackEvent','Contact Form Send','Click/Touch','Footer']);"";
      if($formID == 2) {
         $att = "onclick=\"_gaq.push(['_trackEvent','Another Event','Click/Touch','Footer']);"";
      return $att;

    We can also use switch instead of the if statement:

    switch ($formID) {
      case 1:
        code to be executed if $formID=1;
      case 2:
        code to be executed if $formID=2;
      case 3:
        code to be executed if $formID=3;
        code to be executed if n is different from all labels;

    Unfortunately, adding Google trackers or implementing advanced analytics across the site is out of the scope of support, so you may need to hire a freelance developer or contact our partner Codeable.


    Best regards,


    Thank you, Ismael!



    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.