Set up and test reporting with conversions with cart data

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

Conversions with cart data rely on existing conversion tracking for your website. Before submitting the cart data you need to set up conversion tracking. Alternatively, you can also import Google Analytics 4 conversions or if you are already using SA360 conversion tracking you can simply add the cart data to your existing conversions tag.

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.

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 String “purchase” Only “purchase” events will be processed for cart data.

discount

(optional)

Float 1.50

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

  • Free shipping
  • Limited offer sale

Note: When using Google Analytics as conversion source, the discount parameter is not supported.

aw_merchant_id

(optional)

Integer 98765 The Merchant Center ID. Provide this parameter if you submit 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

(optional)

String “US”

The country associated with the feed where your items are uploaded. Use CLDR territory codes.

Note: When using Google Analytics as a conversion source, please use the parameter aw_feed_label instead.

aw_feed_language

(optional)

String “EN” The language associated with the feed where your items are uploaded. Use ISO 639-1 language codes.

aw_feed_label

(optional)

String “feed_label”

The label associated with the feed where your items are uploaded.

Note: Supported only when using Google Analytics as conversion source.

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.

Note: When using Google Analytics as conversion source, the alternative parameter items.item_id is supported.

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.

 

Example of Google 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>

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 -->
});

Example of providing cart data to Google Tag Manager using JavaScript variables

<!-- 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

To unlock profit reporting, you need to provide the cost_of_goods_sold feed attribute in your Merchant Center product feed. Learn 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 have precise COGS data for your products, but still want to see profit reporting, you can use approximated COGS values. 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 correct implementation of conversions with cart data

If conversions with cart data metrics are not available or showing up incorrectly, you should verify that the conversion tag parameters are implemented correctly. To do this, complete a test order following these steps to see if the parameters are passed correctly:

  1. Open the Chrome Developer Tools by clicking 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?
Search
Clear search
Close search
Google apps
Main menu
648341846893428622
true
Search Help Center
true
true
true
true
true
73067
false
false
false