x

Add "Onclick" tracking code on buttons

Hey guys,
I'm using a conversion code from Google Ads,which asked me to add codes like below to track my conversions:

Contents -
<a onclick="return gtag_report_conversion('http://example.com/your-link');" href="http://example.com/your-link">立即下載!</a>

Buttons -

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

Images -

<img src="download_button.gif" alt="下載白皮書" width="32" height="32" onclick="return gtag_report_conversion('http://example.com/your-link')" />

Since the code for button isn't standard Weebly button,I use html below to add a custom button on my website-which looks EXACTLY like Weebly standard button:


<a class="wsite-button wsite-button-small wsite-button-normal" href="https://line.me/R/ti/p/%40xxt6488p" target="_blank">
<span class="wsite-button-inner">點選立即與線上客服諮詢</span>
<onclick="return gtag_report_conversion(‘https://line.me/R/ti/p/%40xxt6488p')">
</a>

I want to track Who saw our ad,come to our website,and CLICK ON specific buttons,so we can now how good the convertion is,in oreder to improve our ads,but it didn't work wellSmiley Frustrated

One of our cooperated advertise studio claims that Weebly can't add "Onclick" feature on button,also my Google Ads can't recieve any data from it,support team of Google Ads said they got nothing to do with it,I should come and ask people on Weebly instead,so here I am

This means a lot to our business and advertisement,so I really hope there are people can help us outSmiley Sad

Thanks for reading,have a nice daySmiley Happy

1,380 Views
Message 1 of 5
Report
4 REPLIES 4
Square

Thanks for sharing, @Mitch_mooh. I don't see any reason why this wouldn't work to track clicks for the button.

1,372 Views
Message 6 of 5
Report

how to add "onclick" onto the current button? what if you are a free user.

I also have the same questions, there are no input fields via the user interface of the online front-end editor. 

If we upgrade into premium users, can we just edit the code of whole pages?

1,280 Views
Message 6 of 5
Report

I found the answer!

Just simply use <embed code> element under build mode.

1,279 Views
Message 6 of 5
Report
Square

Thanks for updating with your solution, @DDT!

1,278 Views
Message 6 of 5
Report
This thread has been archived and locked. Please start a new thread if you would like to continue the conversation.