This guide helps you monitor all your campaign performances based on orders in one place using Campaign Analytics if you're running an e-commerce store and your main goal is to generate orders. You can easily compare different campaigns based on the conversion goal - number of orders - that matters most to you.
If you use Google Analytics 4 (GA4) to track your orders, you can integrate this data with OptiMonk's Campaign Analytics. This integration allows you to see how your campaigns are performing based on order data from GA4.
Here's what we'll cover:
- Setting up GA4 order data to show in OptiMonk's Campaign Analytics
- Identifying the name of your order event
- Troubleshooting why your order data might not be appearing in Campaign Analytics
Setting up GA4 order data to show in OptiMonk's Campaign Analytics
Tracking orders in Campaign Analytics based on the GA4 order event is straightforward if you use the default settings. By default settings we mean that the order or purchase event is labeled as "purchase." If this is the case, your orders will automatically appear in Campaign Analytics.
However, if your order event has a different name, you will need to set up a Custom Conversion Event to track it.
Important reminder: The Campaign Analytics dashboard updates every hour.
How to identify your order event name
To find out the name of your store's order event, follow these steps after making an order:
- During the process of making an order, open the Inspector tool in your browser.
- Complete the order.
- Go to the Console tab and enter
dataLayer
. - This will display a list of all events triggered during your visit.
- Look for the event related to a purchase or order and note its exact name.
Troubleshooting missing order data in Campaign Analytics
If your order data isn't appearing in Campaign Analytics, the issue might stem from your event name. If the event tracking your orders is named differently from the default "purchase," Campaign Analytics won't automatically recognize it. To resolve this, you'll need to
- either rename your order event or
- create a Conversion Goal based on your thank you page. However, in this case, you’ll see your order data on you campaign detail page, but not in Campaign Analytics.
Supported tracking formats:
1. Using gtag function (reference)
<script> gtag("event", "purchase", { transaction_id: "T_12345_1", value: 30.03, tax: 4.90, shipping: 5.99, currency: "USD", coupon: "SUMMER_SALE", items: [ // If someone purchases more than one item, // you can add those items to the items array { 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: 10.01, quantity: 3 }] }); </script>
2. Using dataLayer.push function (reference)
<script> dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. dataLayer.push({ event: "purchase", ecommerce: { transaction_id: "T_12345", // Sum of (price * quantity) for all items. value: 72.05, tax: 3.60, shipping: 5.99, currency: "USD", coupon: "SUMMER_SALE", 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: 10.01, quantity: 3 }] } }); </script>
Comments