Use a transaction ID to minimize duplicate conversions

Note: The term "order ID" is used instead of transaction ID in the context of offline conversions, including offline conversion adjustments and enhanced conversions for leads. If you use one of these products, you'll use the "Order ID" field to specify the unique ID for a conversion in your CSV uploads or API code.

Transaction IDs are unique identifiers for each transaction, such as an order confirmation number. They help avoid counting duplicate conversions. Use transaction IDs for tracking online and offline conversions.

If you add your conversion tracking tag to a conversion page, such as an order confirmation page, then a conversion should only be counted when a customer has completed a valuable action on your website. However, if a customer returns to the conversion page or reloads the page, it’s possible that the same tag could fire again, and a second conversion could be counted for the same order.

To avoid these duplicate conversions, you can edit your conversion tracking tag to capture a unique transaction ID, such as an order confirmation number you may already be using. If there are 2 conversions for the same conversion action with the same transaction ID, Google Ads will know the second conversion is a duplicate. You'll get an error message, and the duplicate conversion won’t be counted.

In this article, we’ll explain how to add a unique transaction ID to your conversion tracking tag and how to use it with offline conversions.

 


Before you begin

Before you can add transaction IDs to your conversion tracking tag, you’ll need the following:

  • Conversion tracking set up for your website. To follow the instructions below, you’ll need to have created a conversion action in your Google Ads account and added the conversion tag to your website.
  • Unique transaction IDs, such as order confirmation numbers for your transactions. The transaction IDs can include numbers, letters, and special characters like dashes or spaces, with a character limit of 64 characters. They must be unique for each transaction. The transaction IDs must not include any information that could be used to identify individual customers.
  • Ability to edit code on your website. Either you or your web developer will need to edit the conversion tracking tag.

 


Instructions

You’ll need to add a piece of code to your conversion tracking tag to pull the unique order number and send it along in your tag. You don’t need to update anything in your Google Ads account, just update your tag.

Keep in mind

  • Make sure you’re passing a dynamic value for the transaction ID. If your tag sends Google Ads the same ID for different transactions, you could significantly undercount your conversions.
  • The instructions below use Active Server Pages (ASP) as an example. The exact code will vary depending on the server language you use. Make sure to use the right language for your website.

Set up transaction IDs for website conversions

  1. Open the ASP file for your conversion page. (Or, if you use a different server language, open the appropriate 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 transaction ID, find the ASP expression which stores that information. For example: <%= orderId %>.
  3. Open the HTML for your conversion page, and find your event snippet. (You can also make these changes to this snippet before adding it to your conversion page. Edit the snippet according to the instructions below, and then install the snippet according to the instructions in Add a Google tag to your website.)
  4. In the script section of the event snippet (between the <script></script> tags), replace <%= orderId %> with the ASP expression you found in step 2:
    Event snippet example:
    
        <!-- Event snippet for Example conversion page -->
        <script>
         gtag('event', 'conversion', {'send_to': 'AW-123456789/AbC-D_efignoredh12_34-567',
          'value': 1.0,
          'currency': 'USD',
          'transaction_id': '<%= orderId %>',
         });
        </script>
    

    Note: The event snippet only includes the transaction_id parameter by default if you selected the category “Purchase/Sale” while setting up the conversion action.

  5. To test the code, visit your conversion page by completing a conversion on your site.
  6. In your web browser, view the source of the webpage. (In most browsers, you can do this by right-clicking the page and selecting View source). You should be able to view the conversion tracking code between the <head> and </head> tags on your page. The ASP expression will be replaced by the actual transaction ID.

Set up transaction IDs for offline conversions

When you import conversions from ad clicks, you can optionally add a unique transaction ID in the transaction ID (or order ID) column.

 


Transaction ID coding errors

While transaction IDs help avoid counting duplicate conversions, if transaction IDs are incorrectly coded, conversions can be marked as invalid or Google Ads may skip the deduplication process if it finds the same transaction ID used by multiple customers.

Here are some examples of coding errors:

  • Incorrect method to dynamically populate the "Order ID" field:
    • {{ order_number }}
    • [invoice-prefix][invoice-number]
    • Null-user-id
    • Gtm.init
    • <%= orderId %>
    • [object Object].transaction_id
    • <google_ads_transaction_id>
    • Number(order.id).toString()
    • <?php echo $order->id; ?>
  • Incorrect use of the "Order ID” field:
    • Placeholder terms
      • button-confirm
      • congrats
      • thank_you
      • not set
      • buy
      • Page View
      • Conversion Tracking Google Ads
      • 1234
      • https://google.com/
      • google
    • URLs
      • nb-furniture.com
      • https://worldenglishinstitute.org/admin/lesson/read/50
      • towncentrepharmacy.com
      • dovmesilmeuzmani.com
      • https://keptbykrungsri.com/grow-savings
    • Email addresses
    • Prices or currency
      • $17.99
      • $ 5.37
      • $ 21.45
      • $ 15.50
      • USD
      • AUD

 


About transaction ID and the "Count" setting

Adding a transaction ID to your event snippet is not the same as changing your “Count” setting to count one conversion per ad click.

By adding a transaction ID, you avoid counting the same conversion twice, such as when someone re-opens a purchase confirmation page and one purchase would be counted as 2 conversions.

When you change your “Count” setting to one, you count only one conversion after an ad click, even if multiple conversions, such as multiple different purchases resulted from the ad click.

So when should you use “Count” versus transaction ID?

  • If you want to track one lead per ad click, change your count setting to “One.”
  • If you want to track every purchase a customer makes after an ad click, but want to make sure you don’t count the same purchase twice, add a transaction ID to your event snippet. Adding a transaction ID is the recommended option for purchases.

Note:

  • Transaction IDs won't be reported in Google Ads.
  • Adding a transaction ID to your snippet will not resolve duplicate view-through conversions.
  • If your website already has a solution for removing duplicate conversions, we recommend adding the transaction ID as an additional tool to ensure your conversion data is as accurate as possible.
  • If you use Google Tag Manager, you can use transaction IDs. Make sure to enter the transaction ID as a variable, not a static string.

 


Related links

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
7605618106695594241
true
Search Help Center
true
true
true
true
true
73067
false
false
false