Streaming live at 10am (PST)

Custom code on a button

Hi Guys,

I’m hoping you may be able to help me. A client is using Google Ads Conversion Tracking, and they asked me to add the following code to the submit buttons on the below site in the API page and Contact Page Submission buttons.

onclick="return gtag_report_conversion(‘’)

Would you know how or where I would add such code? Sorry for being a bit dense, just never been this deep into Webflow before!

Thanks a million in advance.

Kindest regards,

billy.


Here is my site Read-Only: Webflow - UBO Service
(how to share your site Read-Only link)

https://support.google.com/google-ads/answer/6331304?hl=en

demo example:

<a onclick="goog_report_conversion ('http://example.com/your-link')"
href="http://example.com/your-link">Download now!</a>

“The problem”:

No way to add onclick like this (This is a reversed name):
image

Solution:

The only way to Workaround this issue is:
option 1.: Use custom code embed (Harder to style buttons like this)|

option 2.: Use onClick by JavaScript -or- Jquery (You should know a little code) – you must include this code + conversion tracking tag (The long copy-paste code from google).

<script>
const url = window.location.href;

$( ".target" ).click(function() {
  gtag_report_conversion(url);
});
</script>
  • Put this code before body
  • You need to change (".target") to your button selector (class or id)
  • window.location.href (Get the current absolute url)

gtag_report_conversion(url); could be also a telephone and so on (Related to your conversion setting).

Check your conversion tag:

Notes:

  • If this answer is Chinese for you - you should hire a freelancer.
  • Your issue not exactly related to webflow (More related to google ads).

Follow some related Q:
https://forum.webflow.com/search?q=gtag_report_conversion

Hi,

I appreciate your help with that, and thank you. Going to explore some JS from Google to try and sort this out, thanks for looking into it.

Kindest regards,

billy.