Adding HTML code to CTA button on site

Hi,

I am trying to add an event snippet HTML code from Google Conversions to my main CTA button on my site. Global site tag is installed and the “Outbound Click” event snippet code is also installed to the page as well.

I am at the step where we need to call the “gtag_report_conversion” when someone clicks on the CTA on this page.

I was able to accomplish this by using the HTML Embed and putting this code:

“Submit”

However, its styling doesn’t match my main CTA button as I need it to and when trying to mimic the styling as much as I can with my main CTAs, there is always a difference in the styling. The text background remains white.

My question/ask is:

  1. Can we add the return_gtag_report_conversion to my button instead of using the HTML embed?
  2. If No, to the above question, how can I make HTML embed to be the same styling as my CTA button?

I did look at many similar topics on webflow but they lean towards using tag manager or assigning an “id” to my CTA button and setting up the return_gtag_report_conversion but then I was not able to find where we can assign an id to a button.

I appreciate any help I can get.

Thank you,
Simar


Here is my site Read-Only: https://preview.webflow.com/preview/tavour-com?utm_medium=preview_link&utm_source=designer&utm_content=tavour-com&preview=5fc3d98741417cd93d3e594e03240648&pageId=62967402e981d9f5ef17c587&workflow=preview

You can use a custom attribute to keep return_gtag_report_conversion in a button or a tag. Refer image below.

image

Or you can style your button using custom CSS inside HTML embed.
Use inspect element to get CSS.

1 Like

Hi vikenpatel,

Thanks for the reply.

If I wanted it to do the first way using “custom attributes”. Can you share what I need to input for the name?

And would the value simply be:

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

Thanks,
Simar

Hi vieknpatel,

Just wondering if you had an update on my question?

Yes. That’s correct.

Refer the guide below from Google.

The onclick attribute is reserved by Webflow, so you can’t use it without a workaround. I suggest using element ID instead.