Executive summary

This project connects Olist’s marketing funnel with its e-commerce orders to evaluate lead acquisition, conversion, and downstream seller performance. The analysis focuses on which channels generate leads, which channels convert, and which sources produce sellers with the strongest delivered sales.

The central recommendation is to prioritize organic and paid search, test referral growth, improve source tracking, and review weaker social, email, and display performance before increasing their budgets. Exact return on advertising spend cannot be calculated because channel-level marketing costs are not included.

Business objective

The objective is to answer:

Which marketing channels and seller characteristics generate the strongest conversions and downstream sales for Olist?

Data preparation

The project uses two related Olist datasets:

  • Marketing-qualified leads and closed deals
  • Orders, order items, products, reviews, sellers, and product-category translations
leads <- read_csv(
  file.path(
    marketing_data_dir,
    "olist_marketing_qualified_leads_dataset.csv"
  ),
  show_col_types = FALSE
)

deals <- read_csv(
  file.path(
    marketing_data_dir,
    "olist_closed_deals_dataset.csv"
  ),
  show_col_types = FALSE
)

orders <- read_csv(
  file.path(
    ecommerce_data_dir,
    "olist_orders_dataset.csv"
  ),
  show_col_types = FALSE
)

order_items <- read_csv(
  file.path(
    ecommerce_data_dir,
    "olist_order_items_dataset.csv"
  ),
  show_col_types = FALSE
)

products <- read_csv(
  file.path(
    ecommerce_data_dir,
    "olist_products_dataset.csv"
  ),
  show_col_types = FALSE
)

categories <- read_csv(
  file.path(
    ecommerce_data_dir,
    "product_category_name_translation.csv"
  ),
  show_col_types = FALSE
)

reviews <- read_csv(
  file.path(
    ecommerce_data_dir,
    "olist_order_reviews_dataset.csv"
  ),
  show_col_types = FALSE
)

sellers <- read_csv(
  file.path(
    ecommerce_data_dir,
    "olist_sellers_dataset.csv"
  ),
  show_col_types = FALSE
)

The lead and closed-deal tables are joined with mql_id. A missing seller_id after the left join indicates that the lead did not become a closed deal.

marketing <- leads |>
  left_join(
    deals,
    by = "mql_id"
  ) |>
  mutate(
    converted = if_else(
      is.na(seller_id),
      "No",
      "Yes"
    ),
    first_contact_date = ymd(first_contact_date),
    won_date = parse_date_time(
      won_date,
      orders = c(
        "ymd HMS",
        "ymd HM",
        "ymd"
      ),
      quiet = TRUE
    )
  )

Funnel overview

1–2. Qualified leads, closed deals, and overall conversion

funnel_overview <- marketing |>
  summarise(
    qualified_leads = n_distinct(mql_id),
    closed_deals = sum(
      converted == "Yes",
      na.rm = TRUE
    ),
    conversion_rate =
      closed_deals / qualified_leads * 100
  )

funnel_overview |>
  mutate(
    conversion_rate = paste0(
      round(conversion_rate, 1),
      "%"
    )
  ) |>
  knitr::kable(
    col.names = c(
      "Qualified Leads",
      "Closed Deals",
      "Conversion Rate"
    ),
    caption = "Overall Marketing Funnel"
  )
Overall Marketing Funnel
Qualified Leads Closed Deals Conversion Rate
8000 842 10.5%

Olist recorded 8,000 qualified leads and 842 closed deals, producing an overall conversion rate of 10.5%.

3–4. Lead volume and conversion by marketing source

lead_sources <- marketing |>
  mutate(
    origin = replace_na(
      origin,
      "missing"
    )
  ) |>
  count(
    origin,
    name = "qualified_leads",
    sort = TRUE
  )

channel_performance <- marketing |>
  filter(
    !is.na(origin),
    origin != "unknown"
  ) |>
  group_by(origin) |>
  summarise(
    qualified_leads = n(),
    closed_deals = sum(
      converted == "Yes",
      na.rm = TRUE
    ),
    conversion_rate =
      closed_deals / qualified_leads * 100,
    .groups = "drop"
  ) |>
  arrange(
    desc(conversion_rate)
  )

lead_sources |>
  slice_head(n = 10) |>
  ggplot(
    aes(
      x = qualified_leads,
      y = fct_reorder(
        origin,
        qualified_leads
      )
    )
  ) +
  geom_col(fill = "#2878B5") +
  labs(
    title = "Qualified Leads by Marketing Source",
    x = "Qualified Leads",
    y = "Marketing Source"
  ) +
  theme_minimal()

channel_performance |>
  mutate(
    conversion_rate = paste0(
      round(conversion_rate, 1),
      "%"
    )
  ) |>
  knitr::kable(
    col.names = c(
      "Marketing Source",
      "Qualified Leads",
      "Closed Deals",
      "Conversion Rate"
    ),
    caption = "Conversion Performance by Known Marketing Source"
  )
Conversion Performance by Known Marketing Source
Marketing Source Qualified Leads Closed Deals Conversion Rate
paid_search 1586 195 12.3%
organic_search 2296 271 11.8%
direct_traffic 499 56 11.2%
referral 284 24 8.5%
social 1350 75 5.6%
display 118 6 5.1%
other_publicities 65 3 4.6%
email 493 15 3%
other 150 4 2.7%

Organic search generated the most qualified leads. Among known, scalable sources, paid search produced the highest conversion rate, followed closely by organic search.

5. Time required to close a deal

conversion_time <- marketing |>
  filter(
    converted == "Yes",
    !is.na(first_contact_date),
    !is.na(won_date)
  ) |>
  mutate(
    days_to_convert = as.numeric(
      difftime(
        won_date,
        first_contact_date,
        units = "days"
      )
    )
  ) |>
  filter(days_to_convert >= 0)

conversion_time_summary <- conversion_time |>
  summarise(
    average_days = mean(days_to_convert),
    median_days = median(days_to_convert),
    minimum_days = min(days_to_convert),
    maximum_days = max(days_to_convert)
  )

conversion_time_summary |>
  mutate(
    across(
      everything(),
      ~ round(.x, 1)
    )
  ) |>
  knitr::kable(
    col.names = c(
      "Average Days",
      "Median Days",
      "Minimum Days",
      "Maximum Days"
    ),
    caption = "Time from First Contact to Closed Deal"
  )
Time from First Contact to Closed Deal
Average Days Median Days Minimum Days Maximum Days
49.2 14.7 0.1 427.6

The median is more representative of a typical conversion because a small number of leads took several months to close and increased the average.

Lead and sales-team analysis

6. Lead types among closed deals

lead_type is available only for closed deals, so the dataset cannot support a true conversion-rate comparison by lead type. The analysis below instead identifies the most common lead types among successful conversions.

lead_types <- marketing |>
  filter(
    converted == "Yes",
    !is.na(lead_type)
  ) |>
  count(
    lead_type,
    name = "closed_deals",
    sort = TRUE
  )

lead_types |>
  slice_head(n = 10) |>
  knitr::kable(
    col.names = c(
      "Lead Type",
      "Closed Deals"
    ),
    caption = "Most Common Lead Types Among Closed Deals"
  )
Most Common Lead Types Among Closed Deals
Lead Type Closed Deals
online_medium 332
online_big 126
industry 123
offline 104
online_small 77
online_beginner 57
online_top 14
other 3

7–8. Sales representatives and share of closed deals

The files identify sales representatives only for won deals. Rep-level conversion rates therefore cannot be calculated because unsuccessful assignments are unavailable. The supported measure is each representative’s share of all closed deals.

sales_representatives <- marketing |>
  filter(
    converted == "Yes",
    !is.na(sr_id)
  ) |>
  count(
    sr_id,
    name = "closed_deals",
    sort = TRUE
  ) |>
  mutate(
    percentage_of_deals =
      closed_deals / sum(closed_deals) * 100
  )

sales_representatives |>
  slice_head(n = 10) |>
  mutate(
    percentage_of_deals = paste0(
      round(percentage_of_deals, 1),
      "%"
    )
  ) |>
  knitr::kable(
    col.names = c(
      "Sales Representative ID",
      "Closed Deals",
      "Share of Closed Deals"
    ),
    caption = "Top Sales Representatives by Closed Deals"
  )
Top Sales Representatives by Closed Deals
Sales Representative ID Closed Deals Share of Closed Deals
4ef15afb4b2723d8f3d81e51ec7afefe 133 15.8%
d3d1e91a157ea7f90548eef82f1955e3 82 9.7%
6565aa9ce3178a5caf6171827af3a9ba 74 8.8%
85fc447d336637ba1df43e793199fbc8 64 7.6%
495d4e95a8cf8bbf8b432b612a2aa328 63 7.5%
2695de1affa7750089c0455f8ce27021 59 7%
fbf4aef3f6915dc0c3c97d6812522f6a 59 7%
de63de0d10a6012430098db33c679b0b 53 6.3%
9ae085775a198122c5586fa830ff7f2b 51 6.1%
c638112b43f1d1b86dcabb0da720c901 36 4.3%

Downstream seller performance

The following table connects each converted seller to delivered order items. Exact seller-source duplicates are removed before joining so that order revenue is not multiplied.

known_source_sellers <- marketing |>
  filter(
    converted == "Yes",
    !is.na(origin),
    origin != "unknown",
    !is.na(seller_id)
  ) |>
  select(
    origin,
    seller_id
  ) |>
  distinct()

source_order_items <- known_source_sellers |>
  inner_join(
    order_items,
    by = "seller_id"
  ) |>
  inner_join(
    orders |>
      select(
        order_id,
        order_status
      ),
    by = "order_id"
  ) |>
  filter(
    order_status == "delivered"
  )

source_sales <- source_order_items |>
  group_by(origin) |>
  summarise(
    converted_sellers = n_distinct(seller_id),
    delivered_orders = n_distinct(order_id),
    downstream_sales = sum(
      price,
      na.rm = TRUE
    ),
    .groups = "drop"
  ) |>
  mutate(
    sales_per_seller =
      downstream_sales / converted_sellers
  ) |>
  arrange(
    desc(downstream_sales)
  )

9–11. Orders, downstream sales, and sales per converted seller

source_sales |>
  mutate(
    downstream_sales = currency_br(downstream_sales),
    sales_per_seller = currency_br(sales_per_seller)
  ) |>
  knitr::kable(
    col.names = c(
      "Lead Source",
      "Converted Sellers",
      "Delivered Orders",
      "Downstream Sales",
      "Sales per Seller"
    ),
    caption = "Downstream Seller Performance by Known Lead Source"
  )
Downstream Seller Performance by Known Lead Source
Lead Source Converted Sellers Delivered Orders Downstream Sales Sales per Seller
organic_search 111 1191 R$ 204,510 R$ 1,842
paid_search 100 1234 R$ 151,444 R$ 1,514
social 31 389 R$ 43,394 R$ 1,400
direct_traffic 31 191 R$ 21,853 R$ 705
referral 9 67 R$ 16,578 R$ 1,842
email 6 22 R$ 8,485 R$ 1,414
other 2 86 R$ 6,777 R$ 3,388
display 2 7 R$ 923 R$ 462
source_sales |>
  ggplot(
    aes(
      x = downstream_sales,
      y = fct_reorder(
        origin,
        downstream_sales
      )
    )
  ) +
  geom_col(fill = "#2A9D8F") +
  scale_x_continuous(labels = currency_br) +
  labs(
    title = "Downstream Sales by Known Lead Source",
    x = "Delivered Product Sales",
    y = "Lead Source"
  ) +
  theme_minimal()

Organic search generated the greatest known-source downstream sales. Paid search ranked second, while referrals produced strong sales per converted seller from a smaller base.

Product and customer analysis

The reusable sales_detail table connects delivered order items to products, translated categories, and seller locations.

sales_detail <- order_items |>
  inner_join(
    orders |>
      select(
        order_id,
        order_status
      ),
    by = "order_id"
  ) |>
  filter(
    order_status == "delivered"
  ) |>
  left_join(
    products |>
      select(
        product_id,
        product_category_name
      ),
    by = "product_id"
  ) |>
  left_join(
    categories,
    by = "product_category_name"
  ) |>
  left_join(
    sellers |>
      select(
        seller_id,
        seller_city,
        seller_state
      ),
    by = "seller_id"
  ) |>
  mutate(
    category = coalesce(
      product_category_name_english,
      product_category_name,
      "Unknown"
    )
  )

12. Product categories generating the most sales

category_revenue <- sales_detail |>
  group_by(category) |>
  summarise(
    delivered_orders = n_distinct(order_id),
    items_sold = n(),
    sales_value = sum(
      price,
      na.rm = TRUE
    ),
    .groups = "drop"
  ) |>
  arrange(
    desc(sales_value)
  )

top_category_revenue <- category_revenue |>
  slice_head(n = 10) |>
  mutate(
    category_label = category |>
      str_replace_all("_", " ") |>
      str_to_title()
  )

top_category_revenue |>
  select(
    category_label,
    delivered_orders,
    items_sold,
    sales_value
  ) |>
  mutate(
    sales_value = currency_br(sales_value)
  ) |>
  knitr::kable(
    col.names = c(
      "Product Category",
      "Delivered Orders",
      "Items Sold",
      "Sales Value"
    ),
    caption = "Top Product Categories by Delivered Sales"
  )
Top Product Categories by Delivered Sales
Product Category Delivered Orders Items Sold Sales Value
Health Beauty 8647 9465 R$ 1,233,132
Watches Gifts 5495 5859 R$ 1,166,177
Bed Bath Table 9272 10953 R$ 1,023,435
Sports Leisure 7530 8431 R$ 954,853
Computers Accessories 6530 7644 R$ 888,725
Furniture Decor 6307 8160 R$ 711,928
Housewares 5743 6795 R$ 615,629
Cool Stuff 3559 3718 R$ 610,204
Auto 3810 4140 R$ 578,967
Toys 3804 4030 R$ 471,286
top_category_revenue |>
  ggplot(
    aes(
      x = sales_value,
      y = fct_reorder(
        category_label,
        sales_value
      )
    )
  ) +
  geom_col(fill = "#2878B5") +
  scale_x_continuous(labels = currency_br) +
  labs(
    title = "Top Product Categories by Delivered Sales",
    x = "Product Sales Value",
    y = "Product Category"
  ) +
  theme_minimal()

13. Relationship between sales and customer reviews

Reviews are first reduced to one score per order to prevent orders with repeated review records from multiplying sales during the join.

review_by_order <- reviews |>
  group_by(order_id) |>
  summarise(
    review_score = mean(
      review_score,
      na.rm = TRUE
    ),
    .groups = "drop"
  )

order_category <- sales_detail |>
  group_by(
    order_id,
    category
  ) |>
  summarise(
    items_sold = n(),
    sales_value = sum(
      price,
      na.rm = TRUE
    ),
    .groups = "drop"
  ) |>
  left_join(
    review_by_order,
    by = "order_id"
  )

review_sales_relationship <- order_category |>
  group_by(category) |>
  summarise(
    delivered_orders = n_distinct(order_id),
    items_sold = sum(items_sold),
    sales_value = sum(sales_value),
    average_review_score = mean(
      review_score,
      na.rm = TRUE
    ),
    .groups = "drop"
  )

sales_review_correlation <- review_sales_relationship |>
  summarise(
    correlation = cor(
      sales_value,
      average_review_score,
      use = "complete.obs"
    )
  ) |>
  pull(correlation)

review_sales_relationship |>
  ggplot(
    aes(
      x = sales_value,
      y = average_review_score
    )
  ) +
  geom_point(
    color = "#E76F51",
    alpha = 0.7
  ) +
  geom_smooth(
    method = "lm",
    se = FALSE,
    color = "#264653"
  ) +
  scale_x_continuous(labels = currency_br) +
  labs(
    title = "Category Sales and Average Review Scores",
    subtitle = paste(
      "Correlation:",
      round(sales_review_correlation, 3)
    ),
    x = "Delivered Product Sales",
    y = "Average Review Score"
  ) +
  theme_minimal()

The correlation is 0.018, indicating almost no linear relationship between category sales value and average customer reviews.

Seller analysis

14. Seller location and sales performance

seller_location <- sales_detail |>
  filter(
    !is.na(seller_state)
  ) |>
  group_by(seller_state) |>
  summarise(
    active_sellers = n_distinct(seller_id),
    delivered_orders = n_distinct(order_id),
    sales_value = sum(
      price,
      na.rm = TRUE
    ),
    .groups = "drop"
  ) |>
  mutate(
    sales_per_seller =
      sales_value / active_sellers
  ) |>
  arrange(
    desc(sales_value)
  )

seller_location |>
  slice_head(n = 10) |>
  mutate(
    sales_value = currency_br(sales_value),
    sales_per_seller = currency_br(sales_per_seller)
  ) |>
  knitr::kable(
    col.names = c(
      "Seller State",
      "Active Sellers",
      "Delivered Orders",
      "Sales Value",
      "Sales per Seller"
    ),
    caption = "Top Seller States by Delivered Sales"
  )
Top Seller States by Delivered Sales
Seller State Active Sellers Delivered Orders Sales Value Sales per Seller
SP 1769 68641 R$ 8,509,511 R$ 4,810
PR 335 7512 R$ 1,232,097 R$ 3,678
MG 236 7735 R$ 977,866 R$ 4,144
RJ 163 4227 R$ 820,612 R$ 5,034
SC 184 3603 R$ 613,592 R$ 3,335
RS 125 1962 R$ 373,412 R$ 2,987
BA 18 550 R$ 277,926 R$ 15,440
DF 30 808 R$ 94,840 R$ 3,161
PE 9 403 R$ 91,164 R$ 10,129
GO 39 451 R$ 64,807 R$ 1,662

São Paulo dominates total sales because it contains far more active sellers. Sales per seller should be considered alongside total sales when comparing states of different sizes.

15. Seller segments that may need marketing support

This ranking follows the requested rule of using total delivered sales value only. Low sales may also reflect a small seller base, lower product prices, or category seasonality.

marketing_segments <- marketing |>
  filter(
    converted == "Yes",
    !is.na(seller_id),
    !is.na(business_segment)
  ) |>
  select(
    seller_id,
    business_segment
  ) |>
  distinct()

segment_support <- sales_detail |>
  inner_join(
    marketing_segments,
    by = "seller_id"
  ) |>
  group_by(business_segment) |>
  summarise(
    active_sellers = n_distinct(seller_id),
    delivered_orders = n_distinct(order_id),
    sales_value = sum(
      price,
      na.rm = TRUE
    ),
    .groups = "drop"
  ) |>
  arrange(sales_value)

segment_support |>
  slice_head(n = 5) |>
  mutate(
    sales_value = currency_br(sales_value)
  ) |>
  knitr::kable(
    col.names = c(
      "Business Segment",
      "Active Sellers",
      "Delivered Orders",
      "Sales Value"
    ),
    caption = "Lowest Business Segments by Delivered Sales"
  )
Lowest Business Segments by Delivered Sales
Business Segment Active Sellers Delivered Orders Sales Value
party 1 3 R$ 389
games_consoles 1 2 R$ 657
handcrafted 3 10 R$ 876
gifts 3 7 R$ 1,011
air_conditioning 2 4 R$ 2,650

Recommendations

16. Marketing-budget recommendations

  1. Prioritize organic search. It generated the greatest volume of qualified leads and the highest known-source downstream sales.
  2. Maintain paid-search investment. Paid search achieved a strong conversion rate and ranked second in known-source downstream sales.
  3. Test referral expansion. Referral volume was limited, but sales per converted seller were competitive.
  4. Improve or reduce weaker campaigns. Social, email, and display should be reviewed before receiving additional budget.
  5. Fix source attribution. Unknown and missing sources prevent Olist from accurately assigning revenue and making confident budget decisions.
  6. Track marketing costs. Future reporting should include spend by channel so Olist can calculate cost per acquisition and return on advertising spend.

Limitations

  • Marketing spend is unavailable, so CAC and ROAS cannot be calculated.
  • price represents delivered product sales, not Olist’s commission, profit, or net revenue.
  • Lead type and sales-representative IDs are recorded only for closed deals, preventing fair conversion comparisons for those variables.
  • Unknown and missing marketing sources limit channel attribution.
  • Review scores are attached to orders, while sales are summarized by product category; multi-category orders can associate one review with several categories.
  • The analysis is observational and does not prove that a channel caused stronger seller performance.
  • The historical and anonymized data may not represent Olist’s current operations.

Conclusion

Olist’s strongest known acquisition channels were organic and paid search. Organic search combined scale with the highest known downstream sales, while paid search delivered a competitive conversion rate. Referral traffic showed potential on a smaller base. Improving attribution and adding channel-level marketing costs would allow future analysts to replace directional recommendations with reliable profitability and budget-allocation decisions.