Adwords Conversion Tracking On Click


#1

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 https://support.google.com/google-ads/answer/6331304?hl=en&ref_topic=3165803

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):

<script>
$(’#button-ID’).attr(‘onclick’, ‘goog_report_conversion (“https://domain-to-attribute-conversion-to.com”)’);
</script>

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):

<script>
$("#button-ID").click(function() {
goog_report_conversion (“https://domain-to-attribute-conversion-to.com”);
});
</script>

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


#2

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,