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 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 sale 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 information, you need to adopt Google’s global site tag or Google Tag Manager (GTM). Google Analytics (GA) users who already provide cart data via eCommerce extensions can switch to the global site tag and send the same information to both Google Analytics and Google Ads conversion tracking.

Google Tag Manager makes it easy to maintain tags on your site. Instead of adding and updating tags directly on your site, you add and update them in Google Tag Manager. Google Tag Manager then outputs properly formatted tags on your site as needed. Learn more about Google Tag Manager

When you need to pass dynamically generated data, such as product-level sales data for conversions with cart data reporting, your web developer can either Install a global site tag or use Google Tag Manager.

In order to report on conversions with cart data, your conversion action category must be set to “Purchase/Sale” and included in conversions.

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-hand corner, click the tools icon .
  3. Click the “Measurement” dropdown menu, then click 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 how to set up your conversion tracking tag

Step 2: Install additional parameters into the code

To submit basket information, you will need to install these additional parameters into the code:

Parameter Value Type Example Value Description
event_name= “purchase” String “Purchase” Only 'purchase' events will generate basket information.
items Array 29.2*2*P12345** An array of price, quantity, and item IDs that were purchased.
items.id String 'P12345' Must match the Merchant Center item ID.
items.price Float '29.2' Unit sales price excluding tax, delivery and any transaction-level discounts.
items.quantity Integer “2” Number of items sold.
discount Float “10” Sum of all transaction level discounts, such as: 
  • Free delivery
  • Coupon discounts for the whole basket
aw_merchant_id Integer “12345” The Merchant Center ID where your items are uploaded.
aw_feed_country String “AU” 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.


Example of Global Site Tag configured.

<!-- Sample Code Conversion -->

<script type="text/javascript">
gtag('event', 'purchase', {   "send_to": "AW-9999999999/abc123xyz",   "transaction_id": "017809284",   "value": 23.07,   "currency": "USD",   "discount": 10,   "aw_merchant_id": 12345,   "aw_feed_country": "US",   "aw_feed_language": "EN",   "items": [     {       "id": "P12345",       "quantity": 2,       "price": 50     },     {       "id": "P67890",       "quantity": 1,       "price": 30.4     }   ] }); /* ]]> */ </script>

Step 3 (Optional): Provide the cost_of_goods_sold 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 that you are selling. Google Ads uses this attribute to compute the profit margin on each product (revenue - COGS = profit). If you don’t want to share precise data regarding the cost of your products, but still want to participate, you can fill this field with an approximation (for example, you may estimate your COGS as 80 per cent of the product price for all products in a given category). 

You may provide COGS data in three ways: 

If you choose not to provide the cost_of_goods_sold feed attribute, you won’t be able to see values reported for some of the metrics (e.g. COGS and gross margin).

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-hand corner, click the tools icon .

  3. Click the “Measurement” drop-down menu, then click 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 how to set up your conversion tracking tag

Step 2: Install additional parameters into the code

To submit cart information, please follow the steps below:

  1. Select the conversion tag that you would like to pass the cart information to.

  2. Select the “Provide product-level sales data” box.

  3. Choose your data source of either “Data Layer” or “JavaScript Variables”.

  4. The below variables are required to be added on the checkout page to be referenced.

 
Parameter Value Type Example Value Description
event_name= “purchase” String “Purchase” Only 'purchase' events will generate basket information.
items Array 29.2*2*P12345** An array of price, quantity, and item IDs that were purchased.
items.id String 'P12345' Must match the Merchant Center item ID.
items.price Currency '29.2' Unit sales price excluding tax, delivery and any transaction-level discounts.
items.quantity Integer “2” Number of items sold.
discount Integer “10” Sum of all transaction level discounts, such as: 
  • Free delivery
  • Coupon discounts for the whole basket
aw_merchant_id Integer “12345” The Merchant Center ID where your items are uploaded.
aw_feed_country String “AU” 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.
 

The data layer is used to temporarily hold data. It is a structured format that is understood by Tag Manager to make it easy for you to move that 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 in order for variables to retrieve information. Tag Manager Variables can also be configured to retrieve values directly from JavaScript variables, first-party cookies and from the DOM. However, the best practice is to have your variables retrieve information directly from a well-organised data layer object. A data layer implementation can minimise the likelihood of data loss from inadvertent code changes, encourage a well-organised and accessible data model, and simplify troubleshooting.

Example implementation with Data Layer.

<!-- Sample Code datalayer push -->

dataLayer.push({
 "event": 'purchase',
 "transaction_id": "1545c34e-691e-4726-aeda-b798df255e9c",
 "value": 23.07,
 "currency": "USD",
 "tax": 1.24,
 "shipping": 0,
 "discount": 1.50,
 "aw_merchant_id": 12345,
 "aw_feed_country": "US",
 "aw_feed_language": "EN",
 "items": [
   {
     "id": "P12345",
     "quantity": 2,
     "price": 2
   },
   …
]
});

Example implementation with 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 = 23.07;
currency = "USD";
tax = 1.24;
shipping = 0;
discount = 1.50;
aw_merchant_id = 12345;
aw_feed_country = "US";
aw_feed_language = "EN";
items = [
 {
   "id": "P12345",
   "quantity": 2,
   "price": 2
 },
 ...
];
/* ]]> */
</script>

Step 3 (Optional): Provide the cost_of_goods_sold feed attribute to get reports 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 that you are selling. Google Ads uses this attribute to compute the profit margin on each product (revenue – COGS = profit). If you don’t want to share precise data regarding the cost of your products but still want to participate, you can fill this field with an approximation (e.g. you may estimate your COGS as 80% of the product price for all products in a given category).

You can provide COGS data in three ways:

If you choose not to provide the cost_of_goods_sold feed attribute, you won’t be able to see values reported for some of the metrics (COGS and gross margin, for example).

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. Using Chrome Developer tools, inspect the page to ensure code optimisation by following these steps:
    1. Select the Chrome menuChrome Menu at the top right-hand corner of your browser window, then select Tools > Developer Tools.
    2. Right-click on any page element and select “Inspect Element”. The DevTools window will open at the bottom of your Chrome browser.
  2. In the DevTools window, select 'Network'.
  3. Submit your test order in the web browser.
  4. Search for the request that contains your conversion (search for “/conversion”). The query string parameters should include additional parameters, as shown in the example below:

mid: 12345
fcntr: US flng: EN dscnt: 10 bttype: purchase item: (50*2*P12345**)(30.4*1*P67890**)

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

Related links

 

Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue