Page 1 of 1

Adding code to a button

Posted: Mon Mar 14, 2022 7:57 pm
by johnsmith0251
To track a "link clink" in Google Ads, I need to add code directly to the buttons on my site. I'm not seeing a way to do this through the button properties. Am I correct, or did I overlook something?

If I can't add code through the button properties, I believe I would have to modify the HTML itself. I'm not 100% sure how to do this and am hoping someone with more advanced knowledge might guide me.

This is how the code is:

<div id="wb_estimateBtn1">
<a class="ui-button ui-widget ui-corner-all" id="estimateBtn1" href="https://www.link.com" target="_blank">Request an Estimate</a></div>

This is what I need to add:

<button onclick="return gtag_report_conversion('http://example.com/your-link')">Submit</button>


Any thoughts would be great!

:)

Re: Adding code to a button

Posted: Mon Mar 14, 2022 8:54 pm
by Pablo
You can add this via the 'Events' properties (onclick).

Re: Adding code to a button

Posted: Mon Mar 14, 2022 11:09 pm
by johnsmith0251
Thanks for the very quick reply!

I'm honestly not sure what "action" I need to select for this to work right.

After I know the action, would I also need to add all of this?

<button onclick="return gtag_report_conversion('http://example.com/your-link')">Submit</button>

Sorry, just very confused :(

Re: Adding code to a button

Posted: Tue Mar 15, 2022 7:11 am
by Pablo
You need to select the action 'run javasacript' and copy/paste the code.

Code: Select all

return gtag_report_conversion('http://example.com/your-link');

Re: Adding code to a button

Posted: Tue Mar 15, 2022 4:19 pm
by johnsmith0251
Thank you so much for this level of help! I really appreciate it!