Search
Clear search
Close search
Google apps
Main menu

Track transaction-specific conversion values

When you track customer actions that might have different values each time they occur, such as purchases of items with different prices, you can provide transaction-specific values for each conversion. This helps you have a more accurate sense of your return on investment (ROI).

When setting up a new website or in-app conversion action, you can assign the same conversion value to all conversions (sometimes referred to as "static" values), or different values to reflect transaction-specific (or "dynamic") values. The following information only applies to transaction-specific values.

In the sections below, we'll show you how to edit your conversion tracking tag to support transaction-specific values for your website technology or mobile app platform.

Instructions

How to track transaction-specific values on a website

Part 1: Requirements

Here's what you'll need before you can set up conversion tracking for transaction-specific values on your website:

  • An AdWords account: Don't have one yet? Sign up at https://adwords.google.com.
  • AdWords conversion tracking setup: You must have at least one conversion action to track transaction-specific values. If you haven't done so yet, follow the instructions to create a conversion action and get the tag.
  • A website: This is where you'll put the conversion tracking code (called a "tag").
  • Ability to edit website code: Either you or your or webmaster will need to be able to modify your website.

Part 2: Set up transaction-specific conversion tracking in your AdWords account

First, you'll need to make sure you selected "The value of this conversion action may vary" during the conversion setup process. If not, or you need to check, follow these steps:

  1. Sign in to your AdWords account.
  2. Click the Tools tab, and select Conversions from the drop-down menu.
  3. Click the name of the conversion action you want to edit.
  4. Click the Edit conversion settings button.
  5. Click Value. Select "The value of this conversion action may vary." Provide a backup value to use when one isn't provided. Click Done.
  6. Click Save.
  7. Select one of the two options under "Install your tag."
    • Save instructions and tag: Select this option if you'll be installing the conversion tracking tag on your website yourself.
    • Email instructions and tag: Select this option if someone else, such as your webmaster, will be installing the tag on your website.
  8. Click Done.

Part 3: Add or modify the tag in your website's code

Next, add or modify the tag in your website's code. No matter which technology you use, make sure the page you put the code snippet on is the one your customer sees after a conversion.

When inserting the tag, you'll place it on the static portion of the page, found within the <body> section. See the sections below for detailed instructions on modifying the conversion tag to support transaction-specific values for specific technologies used to generate your webpages:

Active Server Pages (ASP)

If you'd like to add conversion tracking code to ASP pages using your ASP editor, look to the code below, then remove from your own code the lines that are crossed out, and manually add the areas that are highlighted. If you're tracking button or link clicks as conversions instead of page loads, the changes to your code will be slightly different. See these instructions for tracking clicks as conversions for more information.

	<body>
	...
	<!-- Google Code for Purchase Conversion Page -->
	<script type="text/javascript">
	/* <![CDATA[ */
	var google_conversion_id = 1234567890;
	var google_conversion_language = "en";
	var google_conversion_format = "1";
	var google_conversion_color = "666666";
	var google_conversion_label = "xxxxXXx1xXXX123X1xX";
	var google_conversion_value = 1.00;
	if (<%= totalValue %>) {
		var google_conversion_value = <%= totalValue %>;
		var google_conversion_currency = <%= currency %>;
	}
	var google_conversion_currency = "USD";
        var google_remarketing_only = false;
	/* ]]> */
	</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/1234567890/
	?value=<%=totalValue %>&amp;currency_code=<%=currency %>
	&amp;label=xxxxXXx1xXXX123X1xX&amp;guid=ON&amp;script=0">
	</div>
        </noscript>
	</body>
	

If your web server supports Server Side Includes (SSI) you can use an #include statement to insert the conversion tracking code onto your site. After you generate your conversion code snippet, save it to a file on your web server -- we recommend using the filename googleconversion.html.

Search for the </body> tag and place the #include statement with the location of the file directly above it. If the </body> tag is not located within the static portion of the HTML page, add the code snippet so it appears within the body section of the page.

	<head>
	<title>Thank You for Shopping</title>
	</head>
	<body>
	...
	<!-- #include file=".../googleconversion.html" -->
	</body>
		

Keep in mind

Be sure that you do not place the #include statement in the footer or header of the file. This will cause Google to record a conversion every time a customer visits any page on your site.

The #include statement will be evaluated before the rest of the of the ASP pages so you're able to use an ASP expression as the dynamic value of the conversion.

  1. Open your conversion confirmation page ASP file. If multiple pages are generated from the same file, find the section in the ASP file that generates your conversion page.
  2. If your site has a variable conversion value, determine the ASP expression which calculates that value. For example: <%= totalValue %>.
  3. Choose the "Purchase/Sale" conversion category while going through the conversion tracking setup.
  4. Enter a default numeric value in the "Conversion value" field, then replace the line "var google_conversion_value = …" manually with the following:
    	if (<%= totalValue %) {
    	var google_conversion_value = <%= totalValue %>;
    	}
    				
    You'll also need to replace the default numeric value with "<%= totalValue%>" in the <noscript> section of the tag highlighted above.
  5. (Optional) If you accept different currencies, add a line within the if statement to accept currency: var google_conversion_currency = <%= currency %>;

    In the noscript section of the tag, be sure to add &currency_code=<%= currency %>
  6. Copy and save the resulting code snippet.
  7. Insert the conversion tracking code onto the conversion confirmation page. Make sure that the code appears within a static HTML section, not contained within an ASP code section (delineated by <%= and %> markers).
  8. Insert the conversion tracking code directly into the body of the conversion confirmation page. Search for the </body> tag and place the code immediately above it. If the </body> tag isn't located within the static portion of the HTML page, make sure the code snippet is added so it appears within the body section of the page.
  9. Save your conversion confirmation file and upload it to your web server, if necessary. If you'd like to test the placement of your conversion tracking code, visit your conversion page by completing a conversion on your site.
  10. In your web browser, view the source of the webpage (in most browsers, right-click on the page and select View source). You should see the conversion tracking code between the <body> and </body> tags on your page. The ASP expression will be replaced by the actual conversion value when you view the source.
Sun® Java Server Pages (JSP)

To add conversion tracking code to JSP pages using your JSP editor, look to the code below, then remove from your own code the lines that are crossed out, and manually add the areas that are highlighted. If you're tracking button or link clicks as conversions instead of page loads, the changes to your code will be slightly different. See these instructions for tracking clicks as conversions for more information.

		
	<!-- Google Code for Purchase Conversion Page -->
	<script type="text/javascript">
	/* <![CDATA[ */
	var google_conversion_id = 1234567890;
	var google_conversion_language = "en_US";
	var google_conversion_format = "1";
	var google_conversion_color = "666666";
	var google_conversion_label = "xxxxXXx1xXXX123X1xX";
	var google_conversion_value = 1.00;
	if (<%= totalValue %>) {
		var google_conversion_value = <%= totalValue %>;
		var google_conversion_currency = <%= currency %>;
	}
	var google_conversion_currency = "USD";
	var google_remarketing_only = false;
        /* ]]> */ 
	</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/1234567890/
	?value=<%=totalValue %>&amp;currency_code=<%=currency %>
	&amp;label=xxxxXXx1xXXX123X1xX&amp;guid=ON&amp;script=0">
        </div>
	</noscript>
	</body>
		

You can also insert the conversion tracking code onto your site using a server-side jsp:include statement. After you generate your conversion code snippet, save it to a file on your web server - we recommend using the filename googleconversion.html. Search for the </body> tag and place the jsp:include statement with the location of the file directly above it. If the </body> tag isn't located within the static portion of the HTML page, make sure that you add the code snippet so that it appears within the <body> section of the page.

		
	<html>
	<head>
	<title>Thank You for Shopping</title>
	</head>
	<body>
	...
	<jsp:include src=".../googleconversion.html"/>
	</body>
	</html>
		

Keep in mind

Be sure you don't place the jsp:include statement in the footer or header of the file, as is sometimes common. This will cause Google to record a conversion every time a customer visits any page on your site.

The jsp:include statement will be evaluated before the rest of the of the JSP pages so you're able to use a JSP expression as the dynamic value of the conversion.

If your web server supports Server Side Includes (SSI) you can use an #include statement to insert the conversion tracking code onto your site. After you generate your conversion code snippet, save it to a file on your web server. We recommend using the filename googleconversion.html. Search for the </body> tag and place the #include statement with the location of the file directly above it. If the </body> tag isn't located within the static portion of the HTML page, make sure that you add the code snippet so that it appears within the <body> section of the page.

		
	<head>
	<title>Thank You for Shopping</title>
	</head>
	<body>
	...
	#include file=".../googleconversion.html"
	</body>
		

The #include statement will be evaluated before the rest of the of the JSP pages so you're able to use a JSP expression as the dynamic value of the conversion.

Keep in mind

Be sure you do not place the #include statement in the footer or header of the file, as is sometimes common. This will cause Google to record a conversion every time a customer visits any page on your site.

  1. Open your conversion confirmation page JSP file. If multiple pages are generated from the same file, find the section in the JSP file which generates your conversion page.
  2. If your site has a variable conversion value, determine the JSP expression which calculates that value. For example: <%= totalValue %>, ${totalValue}
  3. Choose the "Purchase/Sale" conversion category while going through the conversion tracking setup.
  4. Enter a default numeric value in the "Conversion value" field, then replace the line var google_conversion_value = … manually with the following:
    	if (<%= totalValue %) {
    		var google_conversion_value = <%= totalValue %>;
    	}
    				
    You'll also need to add replace the default numeric value with <%= totalValue%> in the <noscript> section of the tag highlighted above.
  5. (Optional) If you accept different currencies, add a line within the if statement to accept currency: var google_conversion_currency = <%= currency %>;

    In the noscript section of the tag, be sure to add &currency_code=<%= currency %>
  6. Copy and save the resulting code snippet.
  7. Insert the conversion tracking code snippet onto the conversion confirmation page. Make sure that the code appears within a static HTML section, not contained within an JSP code section (delineated by <%@ and %> markers).
  8. Insert the conversion tracking code directly into the body of the conversion confirmation page. Search for the </body> tag and place the code immediately above it. If the </body> tag isn't located within the static portion of the HTML page, be sure you add the code snippet so within the body section of the page.
  9. Save your conversion confirmation file and upload to your web server if necessary. If you'd like to test the placement of your conversion tracking code, go to your conversion page by completing a conversion on your site. In your web browser, view the source of the webpage (in most browsers, right-click on the page and select View source). You should see the conversion tracking code between the <body> and </body> tags on your page. The JSP expression will be replaced by the actual conversion value when you view the source.
PHP: Hypertext Preprocessor (PHP)

To add conversion tracking code to PHP pages using your web page editor, look to the code below, then remove from your own code the lines that are crossed out, and manually add the areas that are highlighted. If you're tracking button or link clicks as conversions instead of page loads, the changes to your code will be slightly different. See these instructions for tracking clicks as conversions for more information.

		
	<!-- Google Code for Purchase Conversion Page -->
	<script type="text/javascript">
	/* <![CDATA[ */
	var google_conversion_id = 1234567890;
	var google_conversion_language = "en";
	var google_conversion_format = "1";
	var google_conversion_color = "666666";
	var google_conversion_label = "xxxxXXx1xXXX123X1xX";
	var google_conversion_value = 1.00;
	if (<? echo $totalValue ?>) {
		var google_conversion_value = <? echo $totalValue ?>;
		var google_conversion_currency = <? echo $currency ?>;
	}
	var google_conversion_currency = "USD";
        var google_remarketing_only = false;
	/* ]]> */ 
	</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/1234567890/?value=
	<? echo $totalValue ?>&amp;currency_code=<? echo $currency ?>
	&amp;label=xxxxXXx1xXXX123X1xX&amp;guid=ON&amp;script=0">
        </div>
	</noscript>
	</body>
		
  1. Open your conversion confirmation page PHP file. If multiple pages are generated from the same file, find the section in the PHP file which generates your conversion page.
  2. If your site has a variable conversion value, determine the PHP expression that displays that value. For example: <?php echo $totalValue ?>, <? echo totalValue ?>
  3. Choose the "Purchase/Sale" conversion category while going through the conversion tracking setup.
  4. Enter a default numeric value in the "Conversion value" field, then replace the line var google_conversion_value = … manually with the following:
    	if (<? echo $totalValue ?>) {
    		var google_conversion_value = <? echo $totalValue ?>;;
    	}
    You'll also need to add replace the default numeric value with <%= totalValue%> in the <noscript> section of the tag highlighted above.
  5. (Optional) If you accept different currencies, add a line within the if statement to accept currency: var google_conversion_currency = <? echo $currency ?>

    In the noscript section of the tag, be sure to add &currency_code=<? echo $currency ?>
  6. Copy and save the resulting code snippet.
  7. Insert the conversion tracking code onto the conversion confirmation page. Make sure that the code appears within a static HTML section, not contained within an PHP code section (delineated by <? and ?> markers). As you insert the code snippet, make sure you place it directly into the body of the conversion confirmation page. To make sure you do, search for the </body> tag and place the code immediately above it. Or, if the </body> tag isn't located within the static portion of the HTML page, make sure that you add the code snippet so that it appears within the <body> section of the page as shown below.
  8. Save your conversion confirmation file and upload to your web server if necessary. If you'd like to test the placement of your conversion tracking code, go to your conversion page by completing a conversion on your site. In your web browser, view the source of the webpage (in most browsers, right-click on the page and select View source). You should see the conversion tracking code between the <body> and </body> tags on your page. The PHP expression will be replaced by the actual conversion value when you view the source.
Webpages containing frames

In cases where frames are used, it's best to insert the code snippet only within the HTML of the frame containing the conversion page.

Secure and non-secure pages

The code snippet can be used safely on both secure (https://) and non-secure (http://) pages.

 

How to track transaction-specific values for mobile in-app actions

Part 1: Requirements

Here's what you'll need before you can set up conversion tracking for transaction-specific values for in-app actions:

  • An AdWords account: Don't have one yet? Sign up at https://adwords.google.com.
  • AdWords conversion tracking set up: You must have at least one conversion action to track transaction-specific values. To create a conversion action and get the tracking code, follow the instructions for your app platform: 
  • A mobile app: You can track conversions in Android and iOS mobile apps.
  • Ability to edit tracking method: Either you or your or app developer will need to be able to modify your in-app action tracking method.

Part 2: Set up transaction-specific conversion tracking in your AdWords account

First, you'll need to make sure you selected "The value of this conversion action may vary" during the conversion setup process. If not, or you need to check, follow these steps:

  1. Sign in to your AdWords account.
  2. Click the Tools tab, and select Conversions from the drop-down menu.
  3. Click the name of the conversion action you want to edit.
  4. Click the Edit conversion settings button.
  5. Click Value. Select "The value of this conversion action may vary." Provide a backup value to use when one isn't provided. Click Done.
  6. Click Save.
  7. Select one of the two options under "Set up your tracking method."
    • Put tracking code into the app: Select this option if you want to use our SDK to add conversion tracking code to your app.
    • Set up a server-to-server connection...: Select this option if you want to use a third-party app analytics server to track AdWords app conversions.
  8. Select whether to download the code yourself or email it to your developer.
  9. Click Done.

Part 3: Update your app code

Next, you'll need to update your tracking method to report transaction-specific values. Refer to the specific instructions for your platform and tracking method:

Was this article helpful?
How can we improve it?
Sign in to AdWords

Get account-specific help and tips by signing in with your AdWords account email address, or learn how to get started with AdWords.