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: https://preview.webflow.com/preview/ubo-service?utm_medium=preview_link&utm_source=designer&utm_content=ubo-service&preview=644c5390610472fb15596d4caaf7664e&pageId=5fb25d15bc116f970ee988b7&mode=preview
(how to share your site Read-Only link)
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):
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://discourse.webflow.com/search?q=gtag_report_conversion
1 Like
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.