Track clicks on your website as conversions

You can use conversion tracking to track when someone clicks a button or link on your website. For example, you can track when someone clicks a “Buy now” button, or when someone clicks a phone number on your mobile website.

This article explains how to add and edit a conversion tracking tag to track customer clicks on your website. To track a conversion on a page load instead, follow these instructions.

Before you begin

Before you can add a conversion tracking tag to your website, you’ll need to:

  • Make sure this kind of conversion tracking is right for you. Read the “Why use it” section below to learn about the reasons you might want to track a conversion on a click rather than a page load.
  • Have the ability to edit your website. Either you or your webmaster will need to be able to add the tag to your website code.

Instructions

Choose the Google Ads experience you're using. Learn more

Follow these steps to track conversions based on clicks on your website or mobile website.

  1. Once you’ve set up your conversion action, your conversion tag should look something like this:
    	<!-- Google Code for Add to Cart 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 = 12345678;
    	  w.google_conversion_label = "abcDeFGHIJklmN0PQ";
    	  w.google_conversion_value = 13.00;
    	  w.google_conversion_currency = "USD";
    	  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>
    	
    
  2. On your website, open the HTML for the page with the button or link that you want to track.
  3. Between the body tags (<body></body>) of the page, paste the conversion tracking tag.
  4. You'll now need to add an onclick command directly to the code for the button or link you want to track. The particular code you use will depend on how the link or button is displayed on your site: as a text link, image, or button:
    • Add the code to a text link: In the code below, replace “http://example.com/your-link” with the URL for your website or telephone link, and replace “Download now!” with your link text.
       
      <a onclick="goog_report_conversion ('http://example.com/your-link')"
      href="http://example.com/your-link">Download now!</a>
      

      Or:
       
      <a onclick="goog_report_conversion ('tel:800-123-4567')"
      href="#">Call now!</a>
      
    • Add the code to a button: In the code below, replace “http://example.com/your-link” with the URL for your website or telephone link, and replace “Download now!” with your button text.
       
      <button onclick="goog_report_conversion('http://example.com/your-link')" href="http://example.com/your-link">Download now!</button>
      

      Or:
       
      <button onclick="goog_report_conversion('tel:800-123-4567')">Call 800-123-4567</button>
      
    • Add the code to an image: In the code below, replace “download_button.gif” with your button image, replace the width and height with your button’s parameters, and replace “http://example.com/your-link” with the URL for your link.
       
      <img src="download_button.gif" alt="Download Whitepaper"
              width="32" height="32"
              onClick="goog_report_conversion
              ('http://example.com/your-link')"/>        

      Or:
       
      <img src="my_phone_button.gif" alt="Call: 800-123-4567"
       width="32" height="32" 
       onClick="goog_report_conversion('tel:800-123-4567')"/>
      

For the tracking to work, you'll need to include both the conversion tracking tag and the appropriate onclick code from one of the examples above. This tells AdWords to record a conversion only when a customer clicks on a chosen link or button.

Check your conversion tag

If you want to make sure your conversion tag is installed and tracking conversions correctly, or you think there may be a problem with the tag, read these instructions for checking your conversion tracking tag.

Was this article helpful?
How can we improve it?
Previous New