How to track Google Adwords onclick conversion?

Google Adwords does not offer code to add to your page to recount the conversion if someone clicks on the link. But since this is Javascript, I am sure there is a way to do this.

Here, Google’s (unchanged) code allows you to include on a page that should be considered a conversion (most of the time thanks page):

<!-- Google Code for Klick Conversion Page --> <script type="text/javascript"> <!-- var google_conversion_id = 1062751462; var google_conversion_language = "de"; var google_conversion_format = "1"; var google_conversion_color = "ffffff"; var google_conversion_label = "dKXuCODvugEQ5pnh-gM"; var google_conversion_value = 0; //--> </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1062751462/?label=dKXuCODvugEQ5pnh-gM&amp;guid=ON&amp;script=0"/> </div> </noscript> 

With other conversion tracking scenarios, you need to perform some function for conversion. Here, simply adding a JS file to the page may be enough to trigger conversion tracking, and conversion.js calls the function on load (downloading and looking at it after running it through the beatuifier code is really very good work!).

Any idea how to handle this?

+63
javascript onclick google-adwords tracking
Jan 17 '10 at 18:41
source share
5 answers

I don’t know if you found it ... I still mention this for future surfers ...

I searched the same and found this piece of code:

 <script type="text/javascript"> function trackConv(google_conversion_id, google_conversion_label) { var image = new Image(1, 1); image.src = "//www.googleadservices.com/pagead/conversion/" + google_conversion_id + "/?label=" + google_conversion_label + "&script=0"; } </script> 

Then for the links you want to track, simply do the following:

 <a onclick="trackConv(1234567890, 'LQV8CNq6RxCKlPbvAw');" href="http://www.example.com">Link</a> 
+109
Feb 23 2018-11-11T00:
source share

It looks like Google is now offering the onclick option, which you can copy and paste on the Conversions page in AdWords. On the AdWords conversion page:

Add a tag to the button on your website, for example, the Buy Now button.

Here's a snippet from the documentation page called Conversion Tracking on your site . Replace XXXXX with the id and conversion label:

 <!-- Google Code for Conversion Page In your html page, add the snippet and call goog_report_conversion when someone clicks on the chosen link or button. --> <script type="text/javascript"> /* <![CDATA[ */ goog_snippet_vars = function() { var w = window; w.google_conversion_id = XXXXXXX; w.google_conversion_label = "XXXXXXX"; w.google_remarketing_only = false; } // DO NOT CHANGE THE CODE BELOW. goog_report_conversion = function(url) { goog_snippet_vars(); window.google_conversion_format = "3"; var opt = new Object(); opt.onload_callback = function() { if (typeof(url) != 'undefined') { window.location = url; } } var conv_handler = window['google_trackConversion']; if (typeof(conv_handler) == 'function') { conv_handler(opt); } } /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js"> </script> 

And somewhere else in your code

 button.addEventListener('click', function() { console.log('Button clicked!'); goog_report_conversion(); }); 
+17
Apr 02 '16 at 20:19
source share

I have a similar problem.

Problem: My client has a contact page with a form. After the user fills in all the fields of the form, there is a check (to check whether the user has completed all the fields correctly). After verification, the user is redirected to the email server page. There is no Success or Thank you page. So I needed to put the Adwords tag after validating the form.

Decision:

The check was performed as follows:

 var missinginfo = ""; var f = document.forms["CONTACT"]; if (f.name.value == ""){ missinginfo += "\n - name";} . . . if (missinginfo != "") { missinginfo ="_____________________________\n" + "Empty Field" + "incorrectly filled" + missinginfo + "\n_____________________________" alert(missinginfo); return false; } //End of Validation 

So, I added this code snippet:

 else if(missinginfo == ""){ //Check if the form was filled correctly adw_conv(); //Function Name return false; } function adw_conv(){ var img = new Image() //Creates an image using JS to make the request img.src = "http://www.googleadservices.com/pagead/conversion/123456789/?label=-8bcaCNHv6AIQl_v8_QM&amp;guid=ON&amp;script=0"; img.onload = function(){ var form = document.getElementsByName('CONTACT')[0]; form.submit(); }} 

Thus, after checking the form and before the website redirects the user to the email page, the conversion of Adwords will be launched!

+4
Jan 17 2018-12-12T00:
source share

The concept of Google conversion tracking using Ajax on the submit button:

  $.ajax({ type: "POST", url: "enquiry-submit.php", data: data, success: function (result) { $("#msg").fadeIn(400).html(result); /* Conversion Tracking Start */ var google_conversion_id = YOUR_CONVERSION_ID_HERE; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "YOUR_CONVERSION_LABEL_HERE"; var google_remarketing_only = false; $.getScript('//www.googleadservices.com/pagead/conversion.js'); var image = new Image(1, 1); image.src = "//www.googleadservices.com/pagead/conversion/YOUR_CONVERSION_ID_HERE/?label=YOUR_CONVERSION_LABEL_HERE&guid=ON&script=0"; /* Conversion Tracking End */ } }); 

This is 100% working on my Google Ads campaign.

Note. You must verify this by clicking on your ad. The conversion effect will be visible after 12 minutes in your AdWords console

+3
Aug 05 '16 at 11:42 on
source share

Add the code below to the section of the page where you want to track conversions.

 <script> function adwTrack() { var img = new Image(1,1); img.src = "https://www.googleadservices.com/pagead/conversion/XXXXXXXXXX/?value=1.00&amp;currency_code=EUR&amp;label=XXXXXXXXXX&amp;guid=ON&amp;script=0"; 

}

Just replace XXX ... with your actual conversion ID and tag.

Then call the adwTrack () function created above in your onclick event links:

 <a href="#" onclick="adwTrack();">Track This</a> 

You can also do this using GTM: https://www.redflymarketing.com/blog/track-conversions-without-a-thank-you-page/

+2
Apr 25 '15 at 8:49
source share



All Articles