Abdulrahman Elsayed Badawy

Data AnalysisE-commerce analytics

Shop Stats: E-commerce Analytics, A/B Tests and Anomaly Detection

Two years of a simulated online store, analysed end to end to show where customers drop off, which promotions really pay, which test results to trust, and how to catch problems on the day they start.

  • TypeE-commerce analytics
  • RoleSolo project
  • WhenNov 2026
  • 23.9Msessions analysed
  • $134.6Mrevenue covered
  • +2.1%checkout lift recovered
  • 23 of 27anomalies caught
Shop Stats: E-commerce Analytics, A/B Tests and Anomaly Detection

Highlights

  • Analysed a simulated two-year store (23.9M sessions, 1.18M orders, $134.6M revenue) with known planted causes, so every method could be scored against the truth
  • Funnel and segment analysis: mobile brings 55% of visits but converts at 3.5% vs 7.2% on desktop; only 20% of product viewers add to cart
  • A/B tests: recovered a real +2.1% checkout lift (about 13,000 extra orders, roughly $1.5M a year) and correctly reported the second test as no effect
  • Scored promotions on profit, net of demand pulled from nearby weeks: Black Friday −$19k (2024) and +$20k (2025) vs Spring Sale +23% and +29% store-wide profit
  • Anomaly detection caught 23 of 27 abrupt events without seeing the calendar; delivered 4 notebooks, a 14-sheet Excel workbook (about 20,700 live formulas) and a written report in English and Arabic

The problem

Every online store sees its numbers move: a strong week, a bad day, a promotion that seemed to work. The hard part is knowing why. Was it the discount, the season, a broken checkout page, or a wave of fake bot traffic? Without the real reason, money goes into the wrong fixes.

Approach

Shop Stats is a complete analysis of a simulated online store over two years: 23.9 million visits, 1.18 million orders and $134.6 million in sales. All of the data is synthetic. I built the store with known causes deliberately hidden inside it (promotions, a site outage, bugs, a competitor campaign, a carrier strike and two A/B tests, where two versions of a page are shown to similar customers and compared), then analysed it as if those causes were unknown. Because the true answers were known, every method could be scored on whether it found them.

It found them. An automatic early-warning system caught 23 of the 27 sudden events without being told when they happened, and the analysis correctly told apart a checkout redesign that really works from a page badge that does nothing. For a client, that means conclusions you can act on: which fixes to fund, which promotions to repeat, and which "wins" are only noise.

Results

  • The early-warning system caught 23 of 27 sudden events on its own, and 91% of its 1,038 alerts traced back to a real cause.
  • A one-page checkout, tested on 871,313 users, raised checkout completion from 64.4% to 65.7% (+2.1%), all of it on phones and tablets: about 13,000 extra orders, roughly $1.5M a year.
  • Black Friday nearly triples revenue for four days, but after counting orders pulled from the weeks around it, profit was -$19k in 2024 and +$20k in 2025; the Spring Sale added 23% and 29% to store-wide profit.
  • Phones bring 55% of visits but only 3.5% of phone visits end in a purchase, against 7.2% on desktop; only 20% of product viewers add anything to the cart.
  • Loyalty members convert 52% better than non-members, but the programme itself accounts for about 19%; the rest was there before they joined.

What this means for you

The same approach can be applied to your own store data to show exactly where shoppers leave, which promotions earn profit rather than just revenue, and whether a test result is strong enough to bet on. It can also run as a daily early-warning check, so a broken checkout or a bot attack is spotted on day one instead of at month end. You get clear answers with the uncertainty stated honestly, plus an Excel workbook your team can reuse.

FIGURE SUMMARIES

Tools

  • Python (pandas, SciPy, statsmodels)
  • Jupyter
  • Excel
  • Matplotlib

Figures

Select a figure to enlarge it.

The project at a glance

The project at a glance

A one-page overview of the simulated store: 23.9M visits, 3.32M customers, 1.18M orders, 3,000 products and $134.6M in revenue, with the full journey from visit to purchase, delivery, return and review. It also lists what was hidden in the data (12 promotions, 11 internal and 13 outside events, two A/B tests), the analyses run, and the deliverables, including an Excel workbook with 14 sheets and 20.7k live formulas.

Revenue growth and what drove it

Revenue growth and what drove it

Daily revenue over two years, with each promotion and lasting change marked, plus monthly revenue by product category. Year two beat year one by 19% in revenue, 20% in visits and 22% in orders, while average order value slipped 2%. The takeaway: growth came almost entirely from more traffic, and every spike and dip has an identifiable cause.

Where shoppers drop off, and why phones lag

Where shoppers drop off, and why phones lag

Of 23.8M visits, 65% reach a product page, only 20% of those add to cart, and 4.9% of all visits end in a purchase. Phones convert at 3.5% against 7.2% on desktop and lose ground at every step; with all else equal, a phone visit has about half the odds of a desktop visit (0.47) of ending in a purchase. The biggest opportunity is the product-page-to-cart step, especially on mobile.

How each shock hit one step of the journey

How each shock hit one step of the journey

Each event is compared with an unaffected group of shoppers, which stayed almost flat every time. The mobile checkout bug cut the payment-to-purchase rate by 42.9% on phones only, a competitor campaign cut Electronics add-to-cart by 18.7%, and in the economic slowdown shoppers moved to cheaper items (budget products +8.9%, premium -11.9%). It also shows how cutting paid search made the overall conversion rate look better than it really was.

Which customer groups actually matter

Which customer groups actually matter

With 3.3M customers, every difference between groups looks "statistically real", so groups are ranked by how big the difference is. Only preferred device (29.8% of desktop-first customers buy versus 18.8% of phone-first) and loyalty membership (33.4% versus 21.0%) are large enough to act on; country and gender barely matter. A product chart adds that Fashion pairs a high margin with a 20% return rate, while Electronics brings the most revenue at the thinnest margin.

Promotion scorecard: revenue versus real profit

Promotion scorecard: revenue versus real profit

Twelve promotions are scored on revenue and on store-wide profit. Black Friday lifts revenue by 175% and 179%, but once the dips in the weeks before and after are counted, profit comes to -$19k in 2024 and +$20k in 2025. The Spring Sale is the real winner (+23% and +29% store-wide profit), while Back to School and the Beauty buy-one-get-one offer lose money.

A/B test: the one-page checkout

A/B test: the one-page checkout

871,313 users were split 50/50 for six weeks: checkout completion rose from 64.4% to 65.7%, a 2.1% lift worth about 13,000 extra orders a year. The gain is +5.2% on phones and +4.8% on tablets, with nothing on desktop. The right-hand chart shows why the test was not stopped early: it looked like a win on several early days, but only became trustworthy from day 20.

When the answer is "nothing" or "less than it looks"

When the answer is "nothing" or "less than it looks"

The social-proof badge test was large enough to detect a 1.4% lift, yet the effect was +0.07% and none of 20 customer groups showed a real change, so the honest answer is "it does nothing". Loyalty members convert 52% better, but 28% of that gap existed before they joined; the programme's own effect is about 18.7%. The lesson: a good analysis also protects you from paying for changes that do not work.

An early-warning map of two years of alerts

An early-warning map of two years of alerts

Each dot is a day on which a store metric (traffic, checkout steps, categories, sales, payments, deliveries) moved unusually, 1,038 in all, laid against the real events. Without seeing the event calendar, the system caught 23 of the 27 sudden events, and 91% of its alerts trace to a known cause. The 93 alerts left unexplained are all weak, so the system raises few false alarms.

Six problems traced to their exact cause

Six problems traced to their exact cause

Six alerts, each explained by looking one level deeper: a checkout bug that hit phones only, a bot wave of one-page, two-second visits, a viral social spike that brought visitors but no extra orders, a carrier strike that delayed only German deliveries, a defective product with 57% of sales returned against 7% for its category, and a paid search cut dated to the day. The takeaway: an alert says something moved; the drill-down says who, where and why.

ALSO INCLUDED

Full written report in English: "Shop Stats Store Analytics Report.docx" (in this folder).

Full written report in Arabic: "Shop Stats Store Analytics Report - Arabic.docx" (in this folder).

Excel workbook (Shop_Stats_Analysis.xlsx, in the repository): 14 sheets with about 20,700 live formulas that recompute every rate and test, including a live early-warning detector and a test-size calculator.

LINKS

Code and full documentation: https://github.com/MrThetaIII/shop-stats-analytics