Adding code to a button

Issues related to hyperlinks and web site navigation.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/links.html
Post Reply
johnsmith0251
 
 
Posts: 209
Joined: Mon Aug 20, 2018 6:47 pm

Adding code to a button

Post 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!

:)
User avatar
Pablo
 
Posts: 21702
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Adding code to a button

Post by Pablo »

You can add this via the 'Events' properties (onclick).
johnsmith0251
 
 
Posts: 209
Joined: Mon Aug 20, 2018 6:47 pm

Re: Adding code to a button

Post 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 :(
User avatar
Pablo
 
Posts: 21702
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Adding code to a button

Post 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');
johnsmith0251
 
 
Posts: 209
Joined: Mon Aug 20, 2018 6:47 pm

Re: Adding code to a button

Post by johnsmith0251 »

Thank you so much for this level of help! I really appreciate it!
Post Reply