Without measurement, marketing an online store is guesswork: you know how much you spent, but not which post, ad or search brought in the customers who actually paid. Google Analytics 4 (GA4) and the Meta Pixel are the two free tools most stores rely on to close that gap. This guide explains what each one does, how to set them up for e-commerce, how to deal with cash-on-delivery realities, and which numbers to watch every week.

Key takeaways

  • GA4 shows how all your traffic behaves and converts; the Meta Pixel measures and optimises your Facebook and Instagram advertising.
  • Track the full shopping journey (view item, add to cart, begin checkout, purchase) with the order value and currency.
  • Pair the Meta Pixel with the Conversions API, using a shared event ID so purchases are not counted twice.
  • Tag every link you share on WhatsApp, Instagram and email with UTM parameters, or that traffic will be misattributed.
  • For cash-on-delivery stores, compare reported purchases with delivered orders, so you judge campaigns on real revenue.

What each tool does

The tools overlap, but they answer different questions. Most stores need both.

Google Analytics 4 Meta Pixel Meta Conversions API
Main purpose Understand all website traffic and sales, from every source Measure and optimise Facebook and Instagram ads; build ad audiences Send the same events to Meta from your server for more reliable measurement
Where it runs In the visitor’s browser (tag) In the visitor’s browser (JavaScript) On your server or a hosted gateway
Key questions answered Which channels, pages and products drive revenue? Where do shoppers drop off? Which ads drove purchases? Who should see retargeting ads? Same as the Pixel, with fewer events lost to ad blockers and browser restrictions
Where you view data GA4 reports and Explorations Meta Events Manager and Ads Manager Meta Events Manager and Ads Manager

A note on versions: Universal Analytics, the older version of Google Analytics, stopped processing data in July 2023 and was fully shut down in 2024. If a guide or developer mentions “UA” tracking codes, it is out of date; GA4 is the only current version. Similarly, what used to be called the Facebook Pixel is now the Meta Pixel.

Setting up Google Analytics 4 for e-commerce

Create the property and data stream

In Google Analytics, create a GA4 property with your business’s time zone and currency (for most Pakistani stores, PKR), then add a web data stream for your store’s domain. You will receive a Measurement ID beginning with “G-“. Add this to your store platform’s analytics setting, or install it through Google Tag Manager. Enhanced measurement, which is on by default, automatically records page views, scrolls, outbound clicks and site search.

Track the e-commerce events that matter

Page views alone will not tell you where shoppers abandon. Google’s recommended e-commerce events map the full journey. The most important are:

  • view_item_list: a shopper sees a category or collection.
  • view_item: a shopper views a product page.
  • add_to_cart and remove_from_cart.
  • view_cart.
  • begin_checkout: the shopper starts checkout.
  • add_shipping_info and add_payment_info: useful for spotting drop-off at delivery or payment steps.
  • purchase: the order is placed.
  • refund: an order is refunded.

For the purchase event, Google’s developer documentation marks transaction_id as required and recommends sending the order value, the currency and an items array with each product’s ID or name. The transaction ID matters: it prevents the same order being counted twice if a customer reloads the thank-you page.

Key events, not “conversions”

In 2024 Google renamed GA4 “conversions” to key events; the term “conversion” now refers to actions counted in Google Ads. On web data streams, purchase is marked as a key event automatically. You can mark others, such as a WhatsApp click or newsletter sign-up, in Admin under Events. Marking is not retroactive, so note the date you make changes.

Housekeeping that keeps data clean

  • Filter out internal traffic from your office and team so your own visits do not inflate numbers.
  • Link GA4 to Google Search Console to see which search queries lead to sales, and to Google Ads if you advertise there.
  • Set data retention to the longest available option so you can compare periods in Explorations.
  • Place test orders after setup and confirm they appear in the Realtime and DebugView reports.

Pakistani stores get a lot of traffic from WhatsApp messages, Instagram bios and stories, influencer posts and SMS. Clicks from apps often arrive without referral information, so GA4 files them as “Direct” and you lose sight of what worked. The fix is UTM parameters added to every link you share:

  • utm_source: where the link is (whatsapp, instagram, newsletter, influencer name).
  • utm_medium: the type of channel (social, message, email, cpc).
  • utm_campaign: the campaign (eid-sale, new-arrivals-march).

For example: yourstore.com/eid-collection/?utm_source=whatsapp&utm_medium=message&utm_campaign=eid-sale. Keep a simple shared spreadsheet of your naming rules so everyone tags links the same way, always in lowercase.

Setting up the Meta Pixel and Conversions API

Install the Pixel and standard events

In Meta Events Manager, create a dataset (Pixel) and add its ID to your store’s Facebook Pixel setting. Then make sure your store sends Meta’s standard e-commerce events:

  • PageView on every page.
  • ViewContent on product pages.
  • AddToCart when a product is added.
  • InitiateCheckout when checkout starts.
  • Purchase on the order confirmation, with value and currency.

Also verify your domain in Meta Business settings, which confirms ownership of your website for advertising and event configuration.

Add the Conversions API

Browser-based tracking loses some events to ad blockers, browser privacy features and visitors who decline cookies. The Meta Conversions API sends events from your server instead. Meta recommends a redundant setup that sends key events through both the Pixel and the Conversions API. Common routes include a platform or partner integration, the Conversions API Gateway (a hosted option that suits teams without developers), server-side Google Tag Manager, or a direct integration by a developer.

Deduplicate, or you will double-count

If the same purchase arrives from both the browser and the server, Meta needs to know it is one event. Meta’s documentation recommends sending a matching event_name and a shared unique event_id (called eventID in the Pixel code) with both. Events are only deduplicated if they arrive within 48 hours of the first event with that ID. Check the setup in Events Manager using Test Events and the Diagnostics tab, and review the Event Match Quality score, which reflects how well the customer information you send can be matched to Meta accounts.

Tip: After any tracking change, place a real test order and compare three numbers the next day: your store’s order list, GA4’s purchases and Meta’s purchases. Small gaps are normal; large gaps mean something is broken or double-counting.

The cash-on-delivery problem in analytics

Both GA4 and the Meta Pixel record a purchase when the order is placed. For a COD-heavy store, some of those orders will be cancelled during confirmation calls or refused at the door. If you judge campaigns on placed orders alone, you can end up scaling the campaign that brings in the most refusals.

Practical ways to handle this:

  1. Measure delivered revenue by source. Each week, compare placed orders and delivered orders for each main campaign or UTM source.
  2. Send refunds to GA4 where your setup allows, so cancelled and returned orders reduce reported revenue.
  3. Use server-side events thoughtfully. With the Conversions API, some stores send a separate custom event when an order is confirmed or delivered, then use it for analysis and, once volume allows, optimisation.
  4. Watch refusal rates by audience. If one ad set or influencer brings many refused orders, adjust targeting, creative or require advance payment for that traffic.

Encouraging card payments also makes data more reliable, because a paid order is a real sale. Our article on cash on delivery vs card payments in Pakistan covers how to nudge customers towards prepayment.

Turning data into growth

Reports to check weekly

Where Report What to look for
GA4 Traffic acquisition Sessions, key events and revenue by channel and campaign
GA4 E-commerce purchases (Monetisation) Best-selling products, and products viewed often but rarely bought
GA4 Funnel exploration Drop-off between product view, cart, checkout and purchase
GA4 Landing pages Pages that attract visits but do not convert
Meta Ads Manager Results by campaign and ad Cost per purchase and return on ad spend, checked against delivered orders
Meta Events Manager Overview and Diagnostics Event volumes, errors, and match quality

Act on what you find

  • High product views, low add-to-cart: improve photos, price presentation or the description. See how to write product descriptions that sell.
  • High add-to-cart, low checkout: check shipping charges, delivery times and whether COD is clearly offered.
  • Checkout drop-off: reduce form fields, test on mobile, and make payment options obvious.
  • A channel that converts well: invest more there, and build similar campaigns.

Use audiences wisely

The Meta Pixel lets you build custom audiences, such as people who viewed products or added to cart in the last 14 days but did not buy, and target them with reminders or offers. You can also create lookalike audiences based on your buyers. Exclude recent purchasers from acquisition campaigns so you are not paying to reach existing customers.

Tracking tools use cookies and collect personal data, so be transparent. Keep your privacy policy and cookie policy up to date and explain what you track and why. If you sell to customers in the European Union or United Kingdom, you will generally need a consent banner and should respect visitors’ choices; Google’s Consent Mode helps GA4 and Google Ads adjust their behaviour based on consent. Customer information sent through the Conversions API, such as email addresses and phone numbers, must be hashed before sending.

Your measurement checklist

  1. GA4 property created with correct time zone and currency; Measurement ID added to your store.
  2. E-commerce events firing, with purchase including transaction ID, value, currency and items.
  3. Internal traffic filtered; Search Console linked.
  4. Meta Pixel installed with PageView, ViewContent, AddToCart, InitiateCheckout and Purchase.
  5. Domain verified in Meta Business settings.
  6. Conversions API connected, with event ID deduplication confirmed in Test Events.
  7. UTM naming rules agreed and used on every shared link.
  8. Test order placed and checked across store, GA4 and Meta.
  9. Weekly comparison of placed vs delivered orders by source.
  10. Privacy and cookie policies updated.

How Baselyne helps

Every Baselyne store supports Google Analytics and the Facebook (Meta) Pixel, so you can start measuring from launch day, and built-in reports in your personalised dashboard show orders and sales alongside them. Because Baselyne handles cash on delivery and card payments in the same system, you can compare what your analytics report with what was actually paid for. See the full list of features, compare plans, or contact support for help connecting your tracking. New to Baselyne? Start a 14-day free trial and connect your tracking before your first campaign.

Frequently asked questions

Do I need both Google Analytics and the Meta Pixel?

If you advertise on Facebook or Instagram, yes. GA4 gives you an independent view of all traffic sources and how shoppers behave on your site, while the Meta Pixel is what Meta uses to measure and optimise your ads and build retargeting audiences.

Why don’t GA4, Meta and my store show the same number of sales?

They use different attribution rules, time windows and tracking methods, and browser restrictions block some events. Meta may credit an ad for a purchase that GA4 assigns to another channel. Your store’s order records are the source of truth; use the tools to compare trends and channels.

Is Universal Analytics still available?

No. Universal Analytics stopped processing data in July 2023 and was shut down in 2024. Google Analytics 4 is the current version and the one to set up for any store.

What is the Meta Conversions API, and do small stores need it?

It sends conversion events to Meta from a server rather than the browser, so fewer events are lost. If you spend meaningfully on Meta ads, it is worth setting up alongside the Pixel, with deduplication, because better data helps Meta optimise your campaigns.

How should cash-on-delivery stores judge ad performance?

Look beyond placed orders. Compare placed and delivered orders for each campaign or traffic source every week, and calculate cost per delivered order. A campaign with a slightly higher cost per purchase but fewer refusals may be the more profitable one.

Sources