Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Google Conversion Tracking with Joomla Forms

1 week 6 days ago #1

  • Steve's Avatar
  • Steve
  • Posts: 8
Hello -

The tag specialists at Google want this script added to the form to track conversions from the form. Where would I add that? (see attached)

They also added these instructions: INSTRUCTION 1 - ADD THE BELOW CODE IN THE HEAD SECTION OF ALL PAGES INSTRUCTION 2 - ADD THE BELOW CODE ONLY IN THE FOOTER SECTION OF CONTACT FORM PAGE LINE 22, 23 - PLEASE UPDATE THE JAVASCRIPT EMAIL AND PHONE NUMBER VARIABLE BEFORE ADDING THE CODE
Attachments:

1 week 6 days ago #2

  • Artem's Avatar
  • Artem
  • Posts: 10367
Hello Steve,

Take a look at the instruction - code should be added to the head and the footer of your site. The website head and footer it's a Joomla template setting.

Are you using Gridbox or another template?

Regards,
Artem, Balbooa.com

1 week 6 days ago #3

  • Steve's Avatar
  • Steve
  • Posts: 8
Hi Artem-

I did add the script to the header and I think the footer is what is causing the trouble. Attached is the updated information Google sent me. I'm using the Helix template.

Thanks!

-Steve
Attachments:

1 week 3 days ago #4

  • Artem's Avatar
  • Artem
  • Posts: 10367
Steve,

Could you please add code, here to forum (use tag code), I need to play with it on my side

Regards,
Artem, Balbooa.com

1 week 3 days ago #5

  • Steve's Avatar
  • Steve
  • Posts: 8
Hi Artem-

I just summited the fiddle Google sent me to the Balbooa Submit a Ticket page. Let me know if you need anything else.

Thanks!

-Steve

1 week 2 days ago #6

  • Artem's Avatar
  • Artem
  • Posts: 10367
Steve,

If I understand correctly this code should get info from fields email and phone, and send it to Google.
Right?

Regards,
Artem, Balbooa.com

1 week 2 days ago #7

  • Steve's Avatar
  • Steve
  • Posts: 8
Correct. They also supplied a couple of these links about capturing enhanced conversions:

support.google.com/google-ads/answer/9888656?hl=en-GB

support.google.com/google-ads/answer/9888145

Contact E-Mail:
This email address is being protected from spambots. You need JavaScript enabled to view it.

3 days 5 hours ago #8

  • Steve's Avatar
  • Steve
  • Posts: 8
Hi Artem-

Any luck?

Thanks,

-Steve

3 days 4 hours ago #9

  • Artem's Avatar
  • Artem
  • Posts: 10367
Steve,

Sorry for the delay.

Today (Tuesday) we will take a look one more time on the code, I think we can find a solution how to send data from fields.
Thank you for your patience

Regards,
Artem, Balbooa.com

2 days 14 hours ago #10

  • Artem's Avatar
  • Artem
  • Posts: 10367
Steve,

So you have 2 scripts, first one should be placed between head tags in your template

The second one, we have adapted for our Forms

1. Your Form should include 2 fields: email and phone. For the field email, add a class suffix: email-custom-class
For the field, phone add the class suffix: phone-custom-class

Check the attached screen:





After that open the code editor in Forms and add this code:
<script>
  var enhanced_conversion_data = {
      "email": "",  
      "phone_number": ""
  };
</script>
<script>
  window.addEventListener('load', function() {
    var set = setInterval(function() {
        if (jQuery('.ba-thank-you-animation-in').length > 0) {
            enhanced_conversion_data.email = document.querySelector('.email-custom-class input').value;
            enhanced_conversion_data.phone_number = document.querySelector('.phone-custom-class input').value;
            gtag('event', 'conversion', {'send_to': 'AW-X0X2X8X4X2XlXXXCXiXrXIXEXCXXXXX'});
            clearInterval(set);
        }
    }, 2000);
});

</script>

Note, replace AW-X0X2X8X4X2XlXXXCXiXrXIXEXCXXXXX - to original one






Regards,
Artem, Balbooa.com

2 days 12 hours ago #11

  • Steve's Avatar
  • Steve
  • Posts: 8
Hi Artem-

I made the changes and I just sent it off to the Google Tag team for testing.

Thanks for the detailed instructions!

-Steve

2 days 12 hours ago #12

  • Artem's Avatar
  • Artem
  • Posts: 10367
Okay, great :)

Regards,
Artem
Powered by Kunena Forum