Set up and test reporting with conversions with basket data

This article explains how to set up conversions with basket data and submit your basket data. Learn more about reporting conversions with basket data.

Instructions

Conversions with basket data rely on existing conversion tracking for your website. Before submitting the basket 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 basket 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 basket data parameters

To submit basket 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 basket data.

discount

(optional)

Float 1.50

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

  • Free delivery
  • 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, delivery and any transaction-level discounts.
items.quantity Integer 2 Number of item units sold.

 

Example of Google tag implementation with basket 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 basket 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 the 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 that 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% of the product price.

You can 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 basket data

If conversions with basket data metrics are not available or are showing up incorrectly, you should verify that the conversion tag parameters are implemented properly. 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 in the top right-hand 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 basket 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
Main menu
9933432948858762275
true
Search Help Centre
true
true
true
true
true
73067
false
false
false