Welcome to the Instapage Support Center

|

Using the Google Ads conversion tracking tag

Conversions will be triggered either by button clicks or by form submissions on the main page or by visits to a thank you page (used as a conversion page).

First, you will need to install the Google Global site tag. To install the Global site tag, please follow the steps mentioned in Google’s documentation. The Global site tag needs to be added in Settings - JavaScript - Head.

After that. Follow the instructions on point 1 or 2 (lower on this page) and note that the code snippets mentioned there will need to be placed in Settings - Javascript - Body.

javascript.png

1. Conversions triggered by button clicks

For tracking button clicks on your page, you will need to use the following code snippet and customize it to fit your needs:

<script>
window.addEventListener('DOMContentLoaded', function () {
var element = document.querySelector("#element-123 .btn");
element.addEventListener("click", handler);
function handler() {
gtag('event', 'conversion', {'send_to': 'AW-123456789/AbC-D_efG-h12_34-567'});
}
});
</script>

You will need to customize the code with the Google Ads tracking script and change the #elementID with the corresponding element ID that you want to trigger the event.

Here is how you can find the button element ID number:

button_gif.gif

 

2. Conversions triggered by form submissions

When tracking form submissions, in case of a single form on the page, you can use this code snippet:

<script type="text/javascript">
window.instapageFormSubmitSuccess = function( form ){
gtag('event', 'conversion', {'send_to': 'AW-123456789/AbC-D_efG-h12_34-567'});
};

</script>

 

If you have multiple forms on the page, you can use the following code snippet:

<script>
window.instapageFormSubmitSuccess = function( form, wid ){

if ( wid === 123 )
{
//add your event code here;
}
else if ( wid === 124 )
{
//add your event code here;
}
else
{
// do nothing out of a box
}

};
</script>

For this second code snippet, you will need to edit the "wid" value, which is only the digit part of the element ID. For #element-123, the "wid" value is "123". 

3. Conversions triggered on the thank you page

You can also track conversions with a Thank You page. The Google Ads conversion tracking tag that was implemented on the landing page will fire upon page visit. This tracking tag, as Google mentioned, needs to be implemented on a Thank You page, because it will load only after the user has converted.

If you want to track conversions with a Thank You page, please follow the instructions described in this article.

How to track events from different tracking platforms

If you need to track conversions using events from both Facebook and Google Analytics or Google Ads, you just need to add the code for that platform in the same function, instead of copying the entire code again. This is because the function only needs to be triggered once. If you use the same code with the same function twice, the second function will override the first one. You can find the content of the respective functions in the dedicated articles for conversion tracking for the other platforms, linked above.

1. For form submissions

<script type="text/javascript">
window.instapageFormSubmitSuccess = function( form ){
// insert the content of the function
// for all the desried tracking platforms here

};
</script>

2. For button clicks

<script>
window.addEventListener('DOMContentLoaded', function () {
var element = document.querySelector("#element-123 .btn");
element.addEventListener("click", handler);
function handler() {
// insert the content of the function
// for all the desired tracking platforms here

}
});
</script>

 NOTE: If you also want to see the cost per lead and cost per visitor metrics in your Instapage analytics, you can connect your Google Ads (ex-AdWords) by following the instructions in this article. 

Have more questions? Submit a request
Was this article helpful?
0 out of 2 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!