- If you are currently not tracking conversions, you need to set up conversion tracking for your website.
- Alternatively, you can also import Google Analytics 4 conversions.
- If you are already using Search Ads 360 conversion tracking, you can simply add the basket data to your existing conversion tag.
- If you are planning to track conversions on your app, Google Analytics should be added to your iOS or Android app using Firebase.
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.
Choose how you want to set up conversions with basket data:
Set up with Google Ads
If you choose Google Ads as an implementation source, you will be able to deploy this using the Google tag directly on your website or via Google Tag Manager. Follow the steps below for this implementation method:
- Make sure that standard conversion tracking is already set up to track your purchases.
- Ensure that 'Conversion goal and action optimisation' for the 'Purchase' conversion is set to Primary.
- Add conversions with basket data parameters to standard conversion tracking to enhance data and report metrics. Learn more about conversions with basket data parameters.
- Adding the optional Merchant Center parameters will enhance data quality. This is especially important if you have multiple Merchant Center accounts that use the same item IDs for different products.
Example of Google tag implementation with basket data
<!-- Sample Code Conversion -->
'event', 'purchase'
<script type="text/javascript">
gtag(, {
"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 -->
});
Set up with Google Analytics
If you choose Google Analytics as an implementation method via E-commerce tracking, here are the steps for implementation:
- Ensure that E-commerce tracking is set up where 'item_id' matches the Merchant Center item_id feed. Learn more about how to measure ecommerce.
- Add conversions with basket data parameters to enhance data and report metrics. Review the conversions with basket data parameters section above.
- Adding the optional Merchant Center parameters will enhance data quality. This is especially important if you have multiple Merchant Center accounts.
- Import ecommerce into Google Ads. Learn more about how to import Google Analytics conversions into Google Ads.
- Ensure that 'Conversion goal and action optimisation' for the 'Purchase' conversion is set to Primary.
dataLayer.push({
event: ”purchase”,
ecommerce: {
transaction_id: ”T_12345,
value: 7.77,
tax: 4.90
shipping: 5.99,
currency: “USD”,
coupon: “SUMMER SALE”,
aw_merchant_id: “12345”
aw_feed_country: ‘US”
aw_feed_language: “EN”
items: [
{
item_id: “SKU_12345”,
item_name: “Stan and Friends Tee”,
affiliation: “Google Merchandise Store”,
coupon: “SUMMER_FUN”,
discount: 2.22,
index: 0,
item_brand: “Google”,
item_category: “Apparel”,
item_category2: “Adult”,
item_category3: “Shirts”,
item_category4: “Crew”,
item_category5: “Short sleeve”,
item_list_id: “related_products”,
item_list_name: “Related Products”,
item_variant: “green”,
location_id: “ChIJIQBpAG2ahYAR_6128GcTUEo”,
price: 9.99,
quantity: 1
}]
Set up with Search Ads 360
Follow the steps below for this implementation method:
- Make sure that conversions are already tracked via Floodlight activities.
- Update the Google tag or Google Tag Manager with parameters to enhance data and report metrics.
- Floodlight data will be passed automatically from Search Ads 360 to Google Ads after they are linked.
Set up to track app conversions
- If you haven’t already set up the Google Analytics for Firebase (GA4F) SDK on your app, follow implementation steps 1–8 from 'Track mobile app conversions with Google Analytics'.
- Track purchase events in your app. 'item_id' should be the Merchant Center item_id feed.
- Import the purchase event into Google Ads by ensuring that the new conversion action is set to Primary and counts towards the 'Purchase' goal.
- If you are already using Google Tag Manager, you can continue to use it with Firebase for iOS or Android.
- Add conversions with basket data parameters to enhance data and report metrics. Review Conversions with basket data parameters for more.
- Adding the optional Merchant Center parameters will enhance data quality. This is especially important if you have multiple Merchant Center accounts.
Example of an Android implementation
Bundle product1 = new Bundle();
product1.putString( FirebaseAnalytics.Param.ITEM_ID, "12345" );
product1.putDouble( FirebaseAnalytics.Param.PRICE, 34.00D );
product1.putString( FirebaseAnalytics.Param.CURRENCY, "EUR");
product1.putLong( FirebaseAnalytics.Param.QUANTITY, 2 );
Bundle product2 = new Bundle();
product2.putString( FirebaseAnalytics.Param.ITEM_ID, "67891" );
product2.putDouble( FirebaseAnalytics.Param.PRICE, 29.99D );
product2.putLong( FirebaseAnalytics.Param.QUANTITY, 1 );
// Prepare ecommerce bundle
Bundle ecommerceBundle = new Bundle();
ecommerceBundle.putParcelableArray(FirebaseAnalytics.Param.ITEMS, new Bundle[] {product1, product2});
// Set relevant bundle-level parameters
ecommerceBundle.putString( FirebaseAnalytics.Param.TRANSACTION_ID, "T12345" );
ecommerceBundle.putDouble( FirebaseAnalytics.Param.VALUE, 97.99D );
ecommerceBundle.putString( FirebaseAnalytics.Param.CURRENCY, "USD" );
// Set new conversion basket specific parameters. Fill out dynamically.
ecommerceBundle.putDouble( "discount", 10.00D ); // Discount
ecommerceBundle.putInt( "aw_merchant_id", 12345 ); // Merchant center ID
ecommerceBundle.putString( "aw_feed_country", "US" ); // Feed country
ecommerceBundle.putString( "aw_feed_language", "EN" ); // Feed Language
// Log purchase event with ecommerce bundle
FirebaseAnalytics.logEvent( FirebaseAnalytics.Event.PURCHASE, ecommerceBundle );
Example of an iOS implementation
NSDictionary *product1 = @{
kFIRParameterItemID : @"12345",
kFIRParameterPrice : @34.00,
kFIRParameterCurrency : @"EUR",
kFIRParameterQuantity : @2
};
NSDictionary *product2 = @{
kFIRParameterItemID : @"67891",
kFIRParameterPrice : @29.99,
kFIRParameterQuantity : @1
};
// Prepare ecommerce dictionary.
NSArray *items = @[product1, product2];
NSDictionary *ecommerce = @{
kFIRParameterItems: items,
kFIRParameterTransactionID : @"T12345",
kFIRParameterValue : @97.99,
kFIRParameterCurrency : @"USD",
// Set new conversion basket specific parameters. Fill out dynamically.
@"discount" : @10.00, // Discount
@"aw_merchant_id" : @12345, // Merchant center ID
@"aw_feed_country" : @"US", // Feed country
@"aw_feed_language" : @"EN" // Feed Language
};
// Log purchase event with ecommerce dictionary.
[FIRAnalytics logEventWithName:kFIREventPurchase parameters:ecommerce];