1. Abstract

This case study focuses on analysing the popularity of fashion product categories in an online shopping store using the Clickstream Data for Online Shopping dataset. The main objective is to identify which product categories receive the highest number of clicks from customers.

The analysis is performed using R Programming. The dataset contains information about customer browsing activities. The main product category is selected, and the number of clicks for each category is calculated.

The results are arranged in descending order and presented using a bar chart. This analysis helps an online fashion store understand customer browsing interests and improve product category recommendations.

2. Introduction

Online shopping has become an important part of modern retail businesses. Customers browse different product categories while visiting online stores.

Understanding which categories receive more attention helps businesses improve website navigation, product placement and customer recommendations.

Clickstream data records the pages visited by customers while browsing an online store. By analysing this data, businesses can identify popular product categories.

This case study uses R Programming to analyse fashion category popularity using the Clickstream Data for Online Shopping dataset.

3. Problem Statement

An online fashion store wants to recommend commonly browsed product categories to its customers.

The objective is to identify which main fashion categories receive the highest number of clicks.

Since the dataset contains a large number of browsing records, manually identifying popular categories is difficult. Therefore, R Programming is used to count, sort and visualize the category-wise clicks.

4. Objectives

5. Dataset Description

The dataset used in this case study is Clickstream Data for Online Shopping.

Dataset Details:

The dataset contains customer browsing information from an online clothing store.

The important variable used in this analysis is:

page 1 (main category)

The category codes are:

Code Category
1 Trousers
2 Skirts
3 Blouses
4 Sale

6. Methodology

The analysis is performed using the following steps:

  1. Load the required R libraries.
  2. Import the clickstream dataset.
  3. Inspect the dataset structure and dimensions.
  4. Check for missing values.
  5. Remove records with missing category values.
  6. Convert category codes into readable names.
  7. Count clicks for each category.
  8. Sort categories in descending order.
  9. Create a bar chart using ggplot2.
  10. Save the chart and export the results.

7. Exploratory Data Analysis

Exploratory Data Analysis is performed to understand the dataset before creating the final visualization.

7.1 Load Required Libraries

library(dplyr)
library(ggplot2)

7.2 Import the Dataset

Keep the CSV file in the same folder as this R Markdown file.

click_data <- read.csv(
  "e-shop clothing 2008.csv",
  sep = ";",
  stringsAsFactors = FALSE,
  check.names = FALSE
)

head(click_data)
##   year month day order country session ID page 1 (main category)
## 1 2008     4   1     1      29          1                      1
## 2 2008     4   1     2      29          1                      1
## 3 2008     4   1     3      29          1                      2
## 4 2008     4   1     4      29          1                      2
## 5 2008     4   1     5      29          1                      2
## 6 2008     4   1     6      29          1                      3
##   page 2 (clothing model) colour location model photography price price 2 page
## 1                     A13      1        5                 1    28       2    1
## 2                     A16      1        6                 1    33       2    1
## 3                      B4     10        2                 1    52       1    1
## 4                     B17      6        6                 2    38       2    1
## 5                      B8      4        3                 2    52       1    1
## 6                     C56      6        1                 2    57       1    4

7.3 Inspect the Dataset

str(click_data)
## 'data.frame':    165474 obs. of  14 variables:
##  $ year                   : int  2008 2008 2008 2008 2008 2008 2008 2008 2008 2008 ...
##  $ month                  : int  4 4 4 4 4 4 4 4 4 4 ...
##  $ day                    : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ order                  : int  1 2 3 4 5 6 7 8 9 1 ...
##  $ country                : int  29 29 29 29 29 29 29 29 29 29 ...
##  $ session ID             : int  1 1 1 1 1 1 1 1 1 2 ...
##  $ page 1 (main category) : int  1 1 2 2 2 3 3 4 4 2 ...
##  $ page 2 (clothing model): chr  "A13" "A16" "B4" "B17" ...
##  $ colour                 : int  1 1 10 6 4 6 5 9 6 9 ...
##  $ location               : int  5 6 2 6 3 1 1 5 4 5 ...
##  $ model photography      : int  1 1 1 2 2 2 2 1 2 1 ...
##  $ price                  : int  28 33 52 38 52 57 33 38 48 57 ...
##  $ price 2                : int  2 2 1 2 1 1 2 1 1 1 ...
##  $ page                   : int  1 1 1 1 1 4 4 4 5 2 ...
summary(click_data)
##       year          month            day            order        
##  Min.   :2008   Min.   :4.000   Min.   : 1.00   Min.   :  1.000  
##  1st Qu.:2008   1st Qu.:4.000   1st Qu.: 7.00   1st Qu.:  2.000  
##  Median :2008   Median :5.000   Median :14.00   Median :  6.000  
##  Mean   :2008   Mean   :5.586   Mean   :14.52   Mean   :  9.817  
##  3rd Qu.:2008   3rd Qu.:7.000   3rd Qu.:22.00   3rd Qu.: 12.000  
##  Max.   :2008   Max.   :8.000   Max.   :31.00   Max.   :195.000  
##     country        session ID    page 1 (main category) page 2 (clothing model)
##  Min.   : 1.00   Min.   :    1   Min.   :1.000          Length   :165474       
##  1st Qu.:29.00   1st Qu.: 5931   1st Qu.:1.000          N.unique :   217       
##  Median :29.00   Median :11968   Median :2.000          N.blank  :     0       
##  Mean   :26.95   Mean   :12058   Mean   :2.401          Min.nchar:     2       
##  3rd Qu.:29.00   3rd Qu.:18219   3rd Qu.:3.000          Max.nchar:     3       
##  Max.   :47.00   Max.   :24026   Max.   :4.000                                 
##      colour          location     model photography     price     
##  Min.   : 1.000   Min.   :1.000   Min.   :1.00      Min.   :18.0  
##  1st Qu.: 3.000   1st Qu.:2.000   1st Qu.:1.00      1st Qu.:33.0  
##  Median : 4.000   Median :3.000   Median :1.00      Median :43.0  
##  Mean   : 6.228   Mean   :3.258   Mean   :1.26      Mean   :43.8  
##  3rd Qu.: 9.000   3rd Qu.:5.000   3rd Qu.:2.00      3rd Qu.:52.0  
##  Max.   :14.000   Max.   :6.000   Max.   :2.00      Max.   :82.0  
##     price 2           page     
##  Min.   :1.000   Min.   :1.00  
##  1st Qu.:1.000   1st Qu.:1.00  
##  Median :1.000   Median :1.00  
##  Mean   :1.488   Mean   :1.71  
##  3rd Qu.:2.000   3rd Qu.:2.00  
##  Max.   :2.000   Max.   :5.00
dim(click_data)
## [1] 165474     14

7.4 Check Missing Values

colSums(is.na(click_data))
##                    year                   month                     day 
##                       0                       0                       0 
##                   order                 country              session ID 
##                       0                       0                       0 
##  page 1 (main category) page 2 (clothing model)                  colour 
##                       0                       0                       0 
##                location       model photography                   price 
##                       0                       0                       0 
##                 price 2                    page 
##                       0                       0

7.5 Remove Missing Category Values

category_data <- click_data %>%
  filter(!is.na(`page 1 (main category)`))

8. Visualizations

Visualization helps to understand the popularity of different fashion categories.

8.1 Convert Category Codes into Names

category_data$Category <- factor(
  category_data$`page 1 (main category)`,
  levels = 1:4,
  labels = c("Trousers", "Skirts", "Blouses", "Sale")
)

8.2 Count Clicks for Each Category

category_counts <- category_data %>%
  count(Category, name = "Click_Count")

sorted_categories <- category_counts %>%
  arrange(desc(Click_Count))

top_5_categories <- sorted_categories %>%
  slice_head(n = 5)

knitr::kable(
  top_5_categories,
  caption = "Fashion Category Click Counts"
)
Fashion Category Click Counts
Category Click_Count
Trousers 49742
Sale 38747
Blouses 38577
Skirts 38408

8.3 Create Bar Chart

category_chart <- ggplot(
  top_5_categories,
  aes(
    x = reorder(Category, Click_Count),
    y = Click_Count
  )
) +
  geom_col(fill = "#8F7AAE") +
  coord_flip() +
  labs(
    title = "Fashion Category Popularity",
    subtitle = "Clickstream Data for Online Shopping",
    x = "Fashion Category",
    y = "Number of Clicks"
  ) +
  theme_minimal()

print(category_chart)

8.4 Save the Chart

ggsave(
  "Fashion_Category_Popularity.png",
  plot = category_chart,
  width = 10,
  height = 6,
  dpi = 300
)

8.5 Export the Results

write.csv(
  top_5_categories,
  "Fashion_Category_Click_Counts.csv",
  row.names = FALSE
)

9. Key Findings

The analysis identifies the popularity of four main fashion categories.

The category with the highest number of clicks represents the most frequently browsed category.

The category-wise results are displayed in the frequency table and bar chart. These results help compare customer browsing activity across the available categories.

10. Recommendations

11. Conclusion

This case study analysed the popularity of fashion product categories using the Clickstream Data for Online Shopping dataset.

R Programming was used to import the dataset, inspect the data, remove missing values, count category-wise clicks and create a bar chart.

The visualization provides a clear comparison of the different fashion categories and helps identify which categories receive more customer attention.

The findings can help an online fashion store improve website navigation and product recommendations.

12. Future Scope

The analysis can be extended by studying category popularity across different months and countries.

Further analysis can be performed to understand customer browsing patterns and compare category clicks with actual purchases.

An interactive dashboard can also be developed to help businesses monitor category popularity and make better decisions.

13. References

  1. UCI Machine Learning Repository. Clickstream Data for Online Shopping.

    https://archive.ics.uci.edu/dataset/553/clickstream+data+for+online+shopping

  2. R Core Team. R: A Language and Environment for Statistical Computing.

    https://www.r-project.org/

  3. Wickham, H. et al. ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics.

    https://ggplot2.tidyverse.org/

  4. Wickham, H. et al. dplyr: A Grammar of Data Manipulation.

    https://dplyr.tidyverse.org/