Checking your code in conversion tracking

Once you've set up Conversion Tracking, you might want to double-check that the code snippet you've added to your website is working properly.

To do that, first check that you've placed the conversion code on your conversion page. You can then verify the code a few different ways.

Confirming and verifying conversion tracking code

After you (or your website manager) install conversion tracking code on your site, you can confirm that the code is on the correct page and verify your code snippet by following the instructions below.

Confirm that the code is on the correct page
  1. Go to the website on which you're tracking conversions and visit the conversion confirmation page. That's the page customers see after they've completed a conversion -- say, a "thank you" page after they make a purchase or sign up for a newsletter.
  2. Check the source code for the page. In Google Chrome, click View, then click Developer, then View Source. You can also right-click to choose View Page Source. Steps will be different in other browsers.
  3. Now look for the conversion code. If the code was successfully placed, you'll see a comment tag that looks like this: <! -- Google Code for {Action name} Conversion Page -->. The {Action name} should be the one you entered earlier in the field "Action name."
  4. If the code isn't on the page, you or whoever maintains your website will need to go through the conversion tracking setup process and add the code.
Verify code snippet

Here are four options for verifying that conversion tracking and your code are set up correctly. It’s best to use one of the first two options, since the other options require you to click on your ad, and you’ll be charged for the click. (If you're very familiar with website code, see the "Debugging your code" section below. It'll show you another way to verify conversion tracking without costing you a click.)

  • Use Tag Assistant
    Tag Assistant is a free Chrome Extension that automatically checks Google code snippets on any page in real time. It’ll show you the tags and errors found, help you resolve the problem, and make suggestions for improvements, including updates to old codes. Download and install Tag Assistant via the Google Chrome Store or visit the Tag Assistant Help Center for more information.

  • Wait for a conversion to occur
    If you know that a click on your AdWords ad resulted in a conversion, and you know the click occurred after you activated conversion tracking, wait for the conversion to appear in your AdWords account.

  • Complete a test conversion on your site and wait for the conversion to appear on AdWords
    Run a search for one of your active keywords on Google and click on your AdWords ad. You can then complete a test conversion on your site. After completing the conversion, it'll appear in your AdWords account within the next 24 hours.

  • Use the Google Site Stats text block on your conversion page
    Run a search for one of your active keywords on Google and click on your AdWords ad. You can then complete a test conversion on your site. If you've opted into using the Google Site Stats text block, you should see a small but clearly visible text block on the pages where you've placed the conversion tracking code. This text block shows that conversion tracking is working. Learn how to install the Google Site Stats text block.

After following the steps for one of these options, you can see conversions in your AdWords account by clicking the Campaigns tab, or by going to the Tools tab and selecting "Conversions."

Understanding conversion tracking code

Here's what a correct conversion tracking code snippet should look like (except for the conversion ID and label and image source, which will look different in your code):

Example of a correct code snippet
Here's what a correct conversion tracking code snippet should look like (except for the conversion ID and label, which will look different in your code):

 
  <script type="text/javascript">
   /* <![CDATA[ */
   var google_conversion_id = 123456789;
   var google_conversion_language = "en";
   var google_conversion_format = "2";
   var google_conversion_color = "ffffff";
   var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
   var google_conversion_value = 0;
   /* ]]> */
   </script>
   <script type="text/javascript" 
  src="//www.googleadservices.com/pagead/conversion.js">
   /script>
   <noscript>
   <div style="display:inline;">
   <img height="1" width="1" style="border-style:none;" alt="" 
  src="//www.googleadservices.com/pagead/conversion/123456789/
  ?label=AAAAAAAAAAAAAAAAAAA&guid=ON&script=0"/>
   </div>
   </noscript>
How conversions are recorded

Every view of your conversion page triggers a conversion request.

If the person viewing your conversion page has the conversion cookie on their computer, a conversion is recorded in your AdWords account. (Only visitors who've clicked your AdWords ad will have this cookie.)

Conversions

This means that if the request is made successfully on your conversion page, a conversion should be recorded in your AdWords account when a visitor with the conversion cookie views your conversion page.

Not sure what all the parameters -- or values -- in the request mean? Here are the most important ones:

  • Conversion ID: This number is unique to your AdWords account. This is how we know what AdWords account the conversion is for.
  • Conversion label: This value is unique for each conversion action you've set up. This is how we know which conversion action to associate with this page.
  • Conversion value: This is the optional value associated with the conversion. When you created your conversion action, you chose either a static value (if the value is the same every time), or a dynamic value (if the value is different) and added a tag that sends AdWords your conversion values. You can edit conversion value settings at any time.
  • Conversion URL: This is the URL that's shown in the Webpages tab of conversion tracking reports.

Troubleshooting your code snippet

Now that you know how things should look, here are some problems you might want to check for if you don't see conversions in your reports.

Inconsistent security protocol (http vs. https)

The security protocol (http or https) in your Conversion Tracking code snippet must match the security protocol of the page where you're tracking conversions.

If they don’t match, Conversion Tracking could under-report your conversions, and people might see an alert message as they attempt to complete a conversion on your website.

Conversion tracking generates code snippets that automatically detect the security level of a page, so they work with both http and https. If you didn’t generate your code snippets recently, and you’re having trouble because of inconsistent security protocols, we recommend generating a new code snippet and replacing the old one on your page.

The following example would be incorrect for an "https://" page, and could be fixed by replacing the "http://" with "https://":

		
  <script type="text/javascript">
   / *<![CDATA[* /
   var google_conversion_id = 123456789;
   var google_conversion_language = "en";
   var google_conversion_format = "2";
   var google_conversion_color = "ffffff";
   var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
   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/123456789/
  ?label=AAAAAAAAAAAAAAAAAAA&guid=ON&script=0"/>
   </div>
   </noscript>
Missing CDATA comments

Some content management systems or WYSIWYG editors (known as What You See Is What You Get editors) remove the asterisk from the /* <![CDATA[ */ and /* ]]> */ sections of your conversion tracking script.

If you use any form of visual editor to insert JavaScript into your pages, check to make sure it hasn't incorrectly changed the script by eliminating the asterisks in the CDATA code. If it has, add in asterisks in the second and ninth line of your tracking script so that it matches the correct version of the code.

Incorrect

		
  <script type="text/javascript">
    / <![CDATA[ /
   var google_conversion_id = 123456789;
   var google_conversion_language = "en";
   var google_conversion_format = "2";
   var google_conversion_color = "ffffff";
   var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
   var google_conversion_value = 0;
   / ]]> /
   </script>
   <script type="text/javascript" 
  src="//www.googleadservices.com/pagead/conversion.js">
   </script>
   <noscript>
   <div style="display:inline;">
   <img height="1" width="1" style="border-style:none;" alt="" 
  src="//www.googleadservices.com/pagead/conversion/123456789/
  ?label=AAAAAAAAAAAAAAAAAAA&guid=ON&script=0"/>
   </div>
   </noscript>
          
Incorrect script attribute

The language="JavaScript" attribute is an old script tag attribute. In some browsers, and under certain circumstances, this can cause issues with the way the script is executed. To fix this, you’ll want to delete this section of code.

Incorrect

		
  <script language="JavaScript" type="text/javascript">
  /* <![CDATA[ */
  var google_conversion_id = 123456789;
  var google_conversion_language = "en";
  var google_conversion_format = "2";
  var google_conversion_color = "ffffff";
  var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
  var google_conversion_value = 0;
  /* ]]> */
  </script>
  <script language="JavaScript" type="text/javascript" 
  src="//www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <div style="display:inline;">
  <img height="1" width="1" style="border-style:none;" alt="" 
  src="//www.googleadservices.com/pagead/conversion/123456789/
  ?label=AAAAAAAAAAAAAAAAAAA&guid=ON&script=0"/>
  </div>
  </noscript>
            
Dynamic conversion in wrong format

The sale value in your code shouldn't contain a currency prefix ($) or commas (,). If you insert "$20.00," for example, JavaScript will recognize this as a text string instead of a number. This would cause an error, which would mean no conversion or conversion value would be recorded.

Incorrect

		
  <script type="text/javascript">
  /* <![CDATA[ */
  var google_conversion_id = 123456789;
  var google_conversion_language = "en";
  var google_conversion_format = "2";
  var google_conversion_color = "ffffff";
  var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
  var google_conversion_value = 0;
  if ($5,000.00) {
  google_conversion_value = $5,000.00;
  }
  /* ]]> */
  </script>
  <script type="text/javascript" 
  src="//www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <div style="display:inline;">
  <img height="1" width="1" style="border-style:none;" alt="" 
  src="//www.googleadservices.com/pagead/conversion/123456789/
  ?value=$5,000.00&label=AAAAAAAAAAAAAAAAAAA&
  guid=ON&script=0"/>
  </div>
  </noscript>
            

Correct

		
  <script type="text/javascript">
  /* <![CDATA[ */
  var google_conversion_id = 123456789;
  var google_conversion_language = "en";
  var google_conversion_format = "2";
  var google_conversion_color = "ffffff";
  var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
  var google_conversion_value = 0;
  if (5000) {
  google_conversion_value = 5000;
  }
  /* ]]> */
  </script>
  <script type="text/javascript" 
  src="//www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <div style="display:inline;">
  <img height="1" width="1" style="border-style:none;" alt="" 
  src="//www.googleadservices.com/pagead/conversion/
  123456789/?value=5000&label=
  AAAAAAAAAAAAAAAAAAA&guid=ON&script=0"/>
  </div>
  </noscript>

Debugging your code

Each time a conversion code runs, it makes a request to the following URL, where the “XXXXXX” will be your conversion ID (this number length varies):

http://www.googleadservices.com/pagead/conversion/XXXXXXXX/

The request that's sent here includes a number of parameters -- or values. You can review the requests that your code sends to make sure it's working properly. When you do, look for these elements to confirm they match the conversion code generated for the conversion action:

  • Conversion ID: The unique number that's specific to your AdWords account.
  • Conversion label: The unique label that matches the name of the conversion in your AdWords account.

Using a debugging tool, you can see the information sent between your web browser (also know as a client) and the server. This will help you examine the conversion tracking request sent by your browser and identify whether or not the correct conversion ID and label are included.

Available debugging tools
Browser Tool
All Firebug Lite
All Charles
Chrome Built-in Developer Tools (e.g. Resources)
Firefox Live HTTP Headers
Firefox Firebug
Internet Explorer Fiddler
Safari Built-in Activity window
Debugging with Chrome Developer Tools
  1. Open in a new tab in Chrome.
  2. Click the Chrome menu icon on the browser toolbar, select View, then Developer, and then View Source. Developer Tools
    If you don't see the Chrome menu, you can open Developer Tools by pressing Control - Shift - I keys (in Windows) or Command - Option - I (on a Mac).
  3. Click on the Network tab. Chrome inspector
  4. Leave the developer tools window open.
  5. Navigate to the page that contains the conversion tracking code.
  6. Look for the request: www.googleadservices.com.
  7. Examine the components of the conversion tracking request to verify it matches your account and conversion name.
Examining the conversion request

All conversion tracking requests begin with the same URL structure:

www.googleadservices.com/pagead/conversion/

The full request will look something like this:

      http://www.googleadservices.com/pagead/conversion/123456789/
       
        ?

        random=1309518235472
        
        &cv=6
        
        &fst=1309518235472
        
        &num=1

        &fmt=2
        
        &value=0
        
        &label=AAAAAAAAAAAAAAAAAAA
        
        &bg=ffffff
        
        &hl=it

        &guid=ON
        
        &u_

        h=1200
        
        &u_w=1920
        
        &u_ah=1174&

        u_aw=1920
        
        &u_cd=24
        
        &u_his=2
        
        &u_tz=60
        
        &u_

        java=true
        
        &u_nplug=19
        
        &u_nmime=97
        
        &
        
        url=http%3A//www.example.com/conversion-page.html
        

The number after www.googleadservices.com/pagead/conversion/ should match your conversion ID, and the characters after &label= should match your conversion label. If they don't, this code is most likely tied to a different conversion action.

To fix this, you may need to generate new conversion code for this conversion action and place it on your site, or check with anyone else who has access to your website code to see if they've installed conversion tracking code for a different conversion action.