Google Ads Conversion Tracking On Click

community tips scripts banner

Tracking an Adwords conversion on the click of a button requires a small amount of custom code in Unbounce. A click event needs to be attached to the button in order to trigger the Adwords conversion code. Follow the steps below to start tracking an Adwords conversion on the click of a button.

:rotating_light: WARNING: YOU ARE ENTERING DEVELOPER TERRITORY :rotating_light:
This is not an official Unbounce feature. This functionality is based entirely on third party code, and has only been tested in limited applications. Since this isn’t a supported Unbounce feature, our support team will be unable to assist if things go awry. So if you are not comfortable with HTML, Javascript and CSS, please consider consulting an experienced developer.

Step 1.

Follow the click-specific Google Ads Set Up Instructions

Step 2.

Add the conversion code generated in Adwords to the page via the Javascript tab at the bottom of the page builder (this is essentially taking care of step 3 in Google’s documentation).

Step 3.

Step 4 in Google’s instructions is to add the html for a button to the page and give it an “onclick” attribute to trigger the conversion script. The html of a button cannot be edited in Unbounce, so instead the click event can be added to the button using some javascript. There are two approaches that can be used to trigger the conversion code from Adwords:

Assiging an onclick Attribute
The following code will generate the html as per Google’s documentation (remember to add the button ID and the URL for the Adwords conversion):

$(’#button-ID’).attr(‘onclick’, ‘goog_report_conversion (“”)’);

Assign a Click Event to the Button
If you are using a later version of jQuery than what’s supplied by default in the builder (1.4.2) the .attr() function used above will not work. If this is the case the following code will work instead (same as above remember to add the button ID and the URL for the Adwords conversion):

$("#button-ID").click(function() {
goog_report_conversion (“”);

Step 4.

Save and republish the page :slight_smile:

Want to take your Unbounce landing pages + Convertables™ to the next level?
:spinbounce: Check out the Ultimate List of Unbounce Tips, Scripts & Hacks


Thank you,

I’m currently waiting for Google’s support to help me as well since according to them I don’t need to do it this way, so I’m currently on standby, but if they can’t help me and it still doesn’t work, I’ll try this.

Thanks again,

Thanks for writing this helpful post, Rob!

I’m having a little bit of trouble implementing the code. Where do we find the URL to use for the conversion? Is it located in the conversion tag from Google? (the section)

Any insight would be appreciated. :slight_smile: Thanks!

Hi @Andrew_Kopp yes that’s correct you got it! It’s the URL in the conversion tag from Google. Usually this would be the URL for the landing page the conversion is happening on, but it does depend a bit on the specific use case. The relevant URL from the example in Google’s docs is here:

Where in the javascript section do we add the script. Header, before body tag, after body tag etc?

1 Like

Hey, do you think this should work for a link to a whatsapp number? E.g.

I’ve tried this several times and it never works. Anyone have any tips?

I was able to make it work. If you can share a link maybe we can find out what is wrong.