Set up and test reporting Conversions with Cart Data (beta)

When you set up Conversions with Cart Data reporting, you’ll be able to submit your cart data, which will allow you to measure the number of transactions, revenue, and profit generated by your Search and Shopping Ads. If you use Google Ads Conversion Tracking (GACT), you can submit cart data (which products were sold, in what quantity, and for what price) for purchase conversions.

This article explains how to set up Conversions with Cart Data and submit your cart data. Learn more about reporting Conversions with Cart Data

Instructions

To submit cart data, you need to track conversions using either Google’s global site tag or Google Tag Manager (GTM).

Check with your web developer on how to pass dynamically generated data, such as product IDs for products that were sold as part of a conversion.

Note: If you’re already using Google Analytics with Enhanced Ecommerce, passing dynamically generated cart data to global site tag or GTM should be simple. The dynamically generated cart data required by Conversions with Cart Data is similar to the data used by Enhanced Ecommerce.

Install with global site tag

Step 1: Install global site tag

Note: If you’re already using the global site tag conversion tracking code, move to step 2.
  1. Sign in to your Google Ads Account.
  2. In the upper right corner, click the tools icon Google Ads | tools [Icon].
  3. Select Measurement > Conversions.
  4. Click the conversion action that you want to use, or create a new conversion action.
  5. Install the global site tag on your site. Learn more about setting up your conversion tracking tag

Step 2: Add cart data parameters

To submit cart data, you'll need to add these additional parameters into the event snippet code:

Parameter Value Type Example Value Description
event_name String “purchase” Only “purchase” events will be processed for cart data.
discount Float 1.50

Discount, $1.50, applied to the whole order, for example:

  • Free shipping
  • Limited offer sale

aw_merchant_id

(optional)

Integer 98765 (Optional) The Merchant Center ID. Provide this parameter if you keep an item in several Merchant Center accounts and you want to control from which Merchant Center the item’s data, for example, its COGS, should be read.
aw_feed_country String “US” The country associated with the feed where your items are uploaded. Use CLDR territory codes.
aw_feed_language String “EN” The country associated with the feed where your items are uploaded. Use CLDR territory codes.
items Array [{
id: "P12345",
price: 12.50,
quantity: 2
}]
An array of price, quantity, and item IDs for each of the items that   were purchased.
items.id String 'P12345' The item ID of the purchased product. It must match the item ID used in the Merchant Center.
items.price Float 12.50 Sales price of a single item, excluding tax, shipping, and any transaction level discounts.
items.quantity Integer 2 Number of units sold of the items.
Here's an example of Global Site Tag implementation with cart data:

<!-- Sample Code Conversion -->
<script type="text/javascript">
gtag('event', 'purchase', {
  "send_to": "AW-9999999999/abc123xyz",
  "transaction_id": "1545c34e-691e-4726-aeda-b798df255e9c",
  "value": 53.50,
  "currency": "USD",
<!-- Start of CwCD Parameters -->
  "discount": 1.50,
  "aw_merchant_id": 98765,
  "aw_feed_country": "US",
  "aw_feed_language": "EN",
  "items": [
    {
      "id": "P12345",
      "quantity": 2,
      "price": 12.50
    },
    {
      "id": "P67890",
      "quantity": 1,
      "price": 30.00
    }
  ]
<!-- End of CwCD Parameters -->
});
/* ]]> */
</script> 

Install with Google Tag Manager

Step 1: Install Google Tag Manager

Note: If you’re already using Google Tag Manager, move to step 2.
  1. Sign in to your Google Ads Account.
  2. In the upper right corner, click the tools icon Google Ads | tools [Icon].
  3. Select Measurement > Conversions.
  4. Click the conversion action that you want to use, or create a new conversion action.
  5. Install Google Tag Manager on your site. Learn more about setting up your conversion tracking tag

Step 2: Add cart data parameters

To submit cart data, follow these steps:

  1. Select the conversion tag you'd like to pass the cart data to.
  2. Check the “Provide product-level sales data” box.
  3. Select either Data Layer or JavaScript Variables as your data source.
  4. Add the required parameters below in the checkout page to be referenced.
Parameter Value Type Example Value Description
event_name String “purchase” Only “purchase” events will be processed for cart data.
discount Float 1.50 Discount, $1.50, applied to the whole order, for example:
  • Free shipping
  • Limited offer sale

aw_merchant_id

(optional)

Integer 98765 (Optional) The Merchant Center ID. Provide this parameter if you keep an item in several Merchant Center accounts and you want to control from which Merchant Center the item’s data, for example, its COGS, should be read.
aw_feed_country String “US” The country associated with the feed where your items are uploaded. Use CLDR territory codes.
aw_feed_language String “EN” The language associated with the feed where your items are uploaded. Use ISO 639-1 language codes.
items Array [{
id: "P12345",
price: 12.50,
quantity: 2
}]
An array of price, quantity, and item IDs for each of the items that were purchased.
items.id String “P12345" The item ID of the purchase product. It must match the item ID used in the Merchant Center.
items.price Float 12.50 Sales price of a single item, excluding tax, shipping, and any transaction level discounts.
items.quantity Integer 2 Number of units sold of the items.

The data layer is used to temporarily store data. It is a structured format that is understood by Tag Manager and makes it easy to move data from your web page or mobile app to tags, triggers, and other variables in Tag Manager.

You don't necessarily need to set up a data layer to retrieve information. Tag Manager variables can also retrieve values directly from JavaScript variables, first-party cookies, and from the DOM. However, the best practice is to have a well-organized data layer object, as it makes your website’s code easier to maintain and troubleshoot, and it minimizes the likelihood of losing conversion data due to inadvertent code changes.

Here’s an example of a data layer implementation:

<!-- Sample Code datalayer push -->
dataLayer.push({
 "event": 'purchase',
 "transaction_id": "1545c34e-691e-4726-aeda-b798df255e9c",
 "value": 53.50,
 "currency": "USD",
<!-- Start CwCD Parameters datalayer push -->
 "discount": 1.50,
 "aw_merchant_id": 98765,
 "aw_feed_country": "US",
 "aw_feed_language": "EN",
 "items": [
   {
     "id": "P12345",
     "quantity": 2,
     "price": 12.50
   },
   {
     "id": "P67890",
     "quantity": 1,
     "price": 30.00
   }
]
<!-- End CwCD Parameters datalayer push -->
});

Here's an example implementation of providing cart data to GTM using JavaScript variables. Note that you must create a user-defined JavaScript variable in GTM to be referenced.

<!-- Sample Code JavaScript Variables-->
<script type="text/javascript">
transaction_id = "1545c34e-691e-4726-aeda-b798df255e9c";
value = 53.50;
currency = "USD";
<!-- Start of CwCD Parameters -->
discount = 1.50;
aw_merchant_id = 98765;
aw_feed_country = "US";
aw_feed_language = "EN";
items = [
 {
   "id": "P12345",
   "quantity": 2,
   "price": 12.50
 },
 {
   "id": "P67890",
   "quantity": 1,
   "price": 30.00
 }
];
<!-- End of CwCD Parameters -->
/* ]]> */
</script>
 

Provide cost of goods sold (COGS) feed attribute to report on profit margins

You must provide the cost_of_goods_sold feed attribute in your Merchant Center product feed if you want to be able to report on profit margins. Learn more about how to create a feed

Cost_of_goods_sold (COGS) represents the cost of the product you are selling. Google Ads uses this attribute to compute the profit margin on each product (profit = revenue - COGS). If you don’t want to have precise COGS data for your products, but still would like would like to see profit reporting, you can set a product’s COGS attribute to an approximated value. For example, you can estimate your COGS as 80% percent of the product price.

You may provide COGS data in 3 ways:

  • Through your product feed
  • Through the Content API
  • By creating a supplemental feed and providing estimates or values for individual products

If you choose not to provide the cost_of_goods_sold feed attribute, you won’t be able to see values reported for some metrics like COGS and gross profit.

Test Conversions with Cart Data

If you have the ability to create a test order, follow these steps to see if the parameters are being passed:

  1. To open Chrome Developer Tools, click the Chrome menu at the top right corner of your Google Chrome web browser, then select More Tools > Developer Tools.
  2. In the "Developer Tools" pane, select Network.
  3. Submit your test order in the Google Chrome web browser.
  4. Search for the request that contains your conversion (search for “/conversion”). The query string parameters should include the cart parameters, as shown in this example:

mid = aw_merchant_id
fcntr = aw_feed_country
flng = aw_feed_language
dscnt = discount
bttype = event type
item = items (the array) mapping all items with (items.id * items.price * items.quantity)

Related links

Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue

Search
Clear search
Close search
Google apps
Main menu
Search Help Center
false
false
true
73067
false
false