(SQL)電商-用戶行為分析

目錄

一、明確分析目的

二、數(shù)據(jù)收集

三、數(shù)據(jù)處理

四、數(shù)據(jù)分析與展現(xiàn)

五、總結(jié)與建議

一、提出問(wèn)題

1.1分析目的

本文在已有的電商用戶行為的基礎(chǔ)上,挖掘數(shù)據(jù)價(jià)值,研究時(shí)間段用戶的轉(zhuǎn)化、下單以及商品銷售情況。從而對(duì)業(yè)務(wù)提出建議,提升電商關(guān)鍵指標(biāo).....

具體研究問(wèn)題如下:

1、用戶在什么時(shí)間段最活躍,容易下單?

2、關(guān)鍵行為指標(biāo)轉(zhuǎn)化情況如何?

3、如何提高指標(biāo)間轉(zhuǎn)化率,從而提高訂單量?

4、那些商品轉(zhuǎn)化情況最好?那些最差,如何優(yōu)化?

5、那些商品類目最受歡迎,訂單量最高?

1.2分析框架


分析框架

二、數(shù)據(jù)理解

2.1數(shù)據(jù)來(lái)源-阿里云天池

鏈接:電商用戶行為數(shù)據(jù)

2.2數(shù)據(jù)介紹

該數(shù)據(jù)為用戶在2017年11月25日至12月3日之間具有點(diǎn)擊,購(gòu)買,向購(gòu)物車中添加商品和偏好商品的所有行為。

數(shù)據(jù)集由用戶ID(user_id),商品ID(item_id),商品類目ID(item_category),行為類型(behavior_type)和時(shí)間戳(create_time)組成。分析樣本量為3835331條數(shù)據(jù)。(原數(shù)據(jù)集約1億)。

2.3數(shù)據(jù)導(dǎo)入

此處參考:Linux環(huán)境下,MySQL數(shù)據(jù)導(dǎo)入,不做詳細(xì)贅述。

三、數(shù)據(jù)處理

表名:use_behavior2

樣本數(shù)據(jù):3835331條

樣本數(shù)據(jù)

3.1刪除重復(fù)數(shù)據(jù)

distinct 刪除重復(fù)值,保留3835329條數(shù)據(jù)放入use_behavior2_2表中。

create table use_behavior2_2 asselect distinct * from use_behavior2?

處理重復(fù)項(xiàng)后數(shù)據(jù)

3.2缺失值處理

在創(chuàng)建表格表格時(shí),5個(gè)字段均定義為not null;數(shù)據(jù)導(dǎo)入保證沒(méi)有缺失值。

create table use_behavior2(user_id int(5) not null,#用戶iditem_id int(20) not null,#商品名稱item_category int(20) not null,#商品類目behavior_type varchar(45) not null,#行為類型create_time int(20) not null);#時(shí)間戳

3、將時(shí)間戳轉(zhuǎn)化為日期時(shí)間形式,同時(shí)增加日期、時(shí)間、周三列

#將時(shí)間戳轉(zhuǎn)化為日期時(shí)間

alter table use_behavior2_2 add column datetime2 varchar(30) null;

update use_behavior2_2 set datetime2 =from_unixtime(create_time,'%Y-%m-%d %H:%i:%s');

#增加日期列

alter table use_behavior2_2 add column dates date null;

update use_behavior2_2 setdates = date_format(datetime2,'%Y-%m-%d')

#增加時(shí)間列

alter table use_behavior2_2 add column times time null;

update use_behavior2_2 set times = date_format(datetime2,'%H:%i:%s')

#增加周列

alter table use_behavior2_2 add column weekdays char(10) null;

update use_behavior2_2 set weekdays = date_format(dates,'%W')

執(zhí)行結(jié)果如下:

轉(zhuǎn)化為日期時(shí)間形式

3.4數(shù)據(jù)異常值處理

#確定日期是否在規(guī)定范圍內(nèi):2017年11月25日至2017年12月3日。

select max(datetime2),min(datetime2) ,max(create_time ),min(create_time ) from use_behavior2_2 ub

執(zhí)行結(jié)果:

異常值處理

將不符合規(guī)定的數(shù)據(jù)刪除,一共刪除1945條數(shù)據(jù):

delete from use_behavior2_2 where datetime2 < '2017-11-25 00:00:00' or datetime2 > '2017-12-04 00:00:00'


再次驗(yàn)證日期時(shí)間的準(zhǔn)確性,下面結(jié)果滿足要求:

異常值處理

3.5判斷行為數(shù)據(jù)

#判斷行為是否為點(diǎn)擊瀏覽(pv),收藏(fav),加入購(gòu)物車(cart),購(gòu)買(buy)

select behavior_type from use_behavior2_2 ub group by behavior_type

執(zhí)行結(jié)果:

判斷行為數(shù)據(jù)

完成以上數(shù)據(jù)處理,最終獲得3833384條數(shù)據(jù)進(jìn)行數(shù)據(jù)分析。

四、構(gòu)建模型

1、整體情況

1.1關(guān)鍵指標(biāo)概覽

select behavior_type,count(*) as 次數(shù),count(distinct user_id) as 人數(shù) from use_behavior2_2 ub group by behavior_type order by behavior_type desc

關(guān)鍵指標(biāo)概覽

1.2平臺(tái)活躍趨勢(shì)

#平臺(tái)整體活動(dòng)趨勢(shì)

select dates as 日期,weekdays,count(*) as 次數(shù),count(distinct user_id) as 人數(shù)from use_behavior2_2 ub group by dates;

整體變化趨勢(shì)

在這個(gè)周期內(nèi),活躍度最高是在12月2號(hào),12月3號(hào)這兩天,明顯有提升。

從平常日活情況來(lái)看,日?;钴S人數(shù)穩(wěn)定在2.6萬(wàn)-2.8萬(wàn)之間。而12月2號(hào)、12月3號(hào)為周六,周日,在周末效應(yīng)之下,日活高達(dá)3.6萬(wàn),商品點(diǎn)擊次數(shù)也有了明顯的上升。

從該時(shí)間段數(shù)據(jù)情況可推測(cè)周末活躍度高于工作日。因用戶的閑暇時(shí)間的增加,活躍與購(gòu)買情況會(huì)明顯高于工作日。因此可多選取一段時(shí)間對(duì)規(guī)律進(jìn)行驗(yàn)證,若屬實(shí),建議平臺(tái)與商家在營(yíng)銷活動(dòng)與運(yùn)營(yíng)安排中,注意結(jié)合客流量對(duì)日常、周末以及法定節(jié)假日等節(jié)點(diǎn)進(jìn)行合理安排。

1.3每日購(gòu)買變動(dòng)情況

#每日購(gòu)買變動(dòng)情況

select dates as 日期,behavior_type as 行為類型,count(*) as 訂單數(shù),count(distinct item_id)as 商品數(shù)量 from use_behavior2_2 ub where behavior_type = 'buy' or behavior_type ='cart'group by dates,behavior_type

?從該購(gòu)買情況來(lái)看,12月2號(hào),3號(hào)周末兩天的購(gòu)買情況同時(shí)增長(zhǎng),加入購(gòu)物車和購(gòu)買也同步發(fā)生變化。

2、平臺(tái)活躍分析

2.1 分時(shí)段活躍情況

#分時(shí)段活躍情況

select date_format(times,'%H:00:00') as 時(shí)段,count(*) as 次數(shù),count(distinct user_id) as 用戶數(shù)from use_behavior2_2group by 時(shí)段

訂單分時(shí)段活躍情況

10點(diǎn)到23為活躍高峰期:10點(diǎn)開始進(jìn)入,一直到19點(diǎn)活躍度基本平穩(wěn)沒(méi)有明顯的差異。20-21點(diǎn)開始迎來(lái)高峰,持續(xù)到22-23點(diǎn)出現(xiàn)下降。

2.2 12月2號(hào),12月3號(hào)分時(shí)段活躍情況

#12月2.3平臺(tái)分時(shí)段活躍情況

select date_format(times,'%H:00:00') as 時(shí)段,count(*) 次數(shù),count(distinct user_id) as 用戶數(shù)from use_behavior2_2 ub where dates ='2017-12-02' or dates = '2017-12-03'group by 時(shí)段


周末分時(shí)段活躍變化

周末與日常活躍趨勢(shì)基本一致,10點(diǎn)進(jìn)入活躍高峰期期,20-21點(diǎn)迎來(lái)高峰期。

建議平臺(tái)與商戶夜間活躍的特性,做好客戶服務(wù)時(shí)間,營(yíng)銷消息推送等安排,以達(dá)到更好的促交易目的。

3、訂單分析

3.1分時(shí)段下單情況

#3.1分時(shí)段下單情況

select date_format(times,'%H:00:00') as 時(shí)段,count(distinct user_id) as 用戶數(shù),count(*) as 訂單from use_behavior2_2 ub where behavior_type = 'buy'group by 時(shí)段


下單時(shí)段分析

下單的整體趨勢(shì)與活躍基本一致,但高峰期增長(zhǎng)較小。晚間最高峰20點(diǎn)-22點(diǎn)與白天10點(diǎn)到17點(diǎn)變動(dòng)趨勢(shì)基本一致,無(wú)太大變化。導(dǎo)致這一現(xiàn)象的可能原因是,晚間高峰期用戶有更多的時(shí)間和輕松的范圍,會(huì)無(wú)意識(shí)瀏覽商品,貢獻(xiàn)活躍。

3.2銷量top10 產(chǎn)品????

#3.2銷量top10 產(chǎn)品

select item_id ,count(*) as 訂單量from use_behavior2_2 ub where behavior_type = 'buy'group by item_id order by 訂單量 desc limit 10


top10商品

以上10款商品是平臺(tái)該事件段內(nèi)銷量最高的10款商品,建議結(jié)合商品表對(duì)商品特性與商品信息分析其受歡迎的原因,從而考慮如何引導(dǎo)商戶調(diào)整商品結(jié)構(gòu)。

3.3客戶量top10的商品

#3.3客戶量top10的商品

select item_id,count(distinct user_id)as 用戶數(shù)from use_behavior2_2 ub where behavior_type = 'buy'group by item_id order by 用戶數(shù) desc limit 10

購(gòu)買客戶量最高的top10商品

以上10款商品是平臺(tái)該段時(shí)間內(nèi)購(gòu)買客戶數(shù)最高的10款商品。

3.4銷量最高的10大品類

#3.4銷量最高的10大品類

select item_category as 商品類目,count(*) as 訂單量,count(distinct item_id) as 商品數(shù)量from use_behavior2_2 ub2 where behavior_type = 'buy'group by item_category order by 商品數(shù)量 desc limit 10

top10品類

3.5最受客戶歡迎的10大品類

#3.5最受客戶歡迎的10大品類

select item_category,count(distinct user_id) as 用戶數(shù),count(distinct item_id)as 商品數(shù)量from use_behavior2_2 ub where behavior_type = 'buy'group by item_category order by 用戶數(shù) desc limit 10

最受客戶歡迎的10大品類

3.6訂單量最少的10個(gè)商品

#3.6訂單最少的10個(gè)商品

select item_id,count(*) as 訂單from use_behavior2_2 ub where behavior_type = 'buy'group by item_id order by 訂單 asc limit 10

訂單量最少的10個(gè)商品

3.7訂單量最少的10個(gè)品類

#3.7訂單量最少的10個(gè)品類

select item_category,count(*) as 訂單from use_behavior2_2 ub where behavior_type = 'buy'group by item_category order by 訂單 asc limit 10

訂單量最少的10個(gè)品類

結(jié)合更多商品信息,分析這10個(gè)品類訂單量低的原因,是類目下商品太少?還是其下商品是季節(jié)性產(chǎn)品?亦或是商品類目拆分過(guò)細(xì)?

4、轉(zhuǎn)化漏斗分析

#用戶漏斗轉(zhuǎn)化分析

create view u3 asselect behavior_type,count(user_id) as 用戶數(shù)from use_behavior2_2 ub group by behavior_type order by behavior_type desc? ? ? ? ? ? ? ? ? ? ?

select behavior_type,(用戶數(shù)/10000) as 用戶數(shù)(單位萬(wàn)) from u3?

點(diǎn)擊—購(gòu)買轉(zhuǎn)化漏斗

從商品轉(zhuǎn)化情況來(lái)看,從點(diǎn)擊到加入購(gòu)物車或者收藏,近9.46%轉(zhuǎn)化率,該轉(zhuǎn)化率過(guò)低,建議商家針對(duì)商品的詳情、標(biāo)題等進(jìn)行優(yōu)化,提高用戶轉(zhuǎn)化率;

從商品購(gòu)買轉(zhuǎn)化情況來(lái)看,如果訂單被加入購(gòu)物車或收藏,將有23.62%的可能性成交;

從點(diǎn)擊至下單,轉(zhuǎn)化率為2.24%。

說(shuō)明:考慮到fav(收藏)與cart(加購(gòu))無(wú)直接轉(zhuǎn)化關(guān)系,隨本案例做合并處理。

5、下單用戶分析

5.1用戶購(gòu)買頻次分析

#5.1用戶購(gòu)買頻次分析

create view u1 as select user_id,count(*) as 訂單量from use_behavior2_2 ub where behavior_type = 'buy'group by user_id

select 訂單量,count(*) as 用戶數(shù) from u1group by 訂單量

從用戶購(gòu)買頻次來(lái)看,在這9天時(shí)間里,有34.2%用戶只成交1單,23.22%用戶成交2單。最高成交量為10單以上占比3.18%。

建議結(jié)合下單金額等指標(biāo),制定高凈值用戶評(píng)價(jià)體系,從而為平臺(tái)營(yíng)銷提供數(shù)據(jù)支持。

5.2用戶排行榜

#5.2用戶排行榜

select user_id,count(*) as 訂單量,count(distinct item_id) as 商品數(shù)量from use_behavior2_2 ub where behavior_type = 'buy'group by user_id order by 訂單量 desc limit 10

用戶排行榜

商品的成交是對(duì)平臺(tái)最有價(jià)值的指標(biāo),也是用戶體現(xiàn)價(jià)值的重要方式。建議對(duì)平臺(tái)高成交量,高成交額用戶予以關(guān)注與精益化運(yùn)營(yíng)。

5.2復(fù)購(gòu)商品分析

#5.2復(fù)購(gòu)商品分析

select user_id,item_id,count(*) as 訂單量from use_behavior2_2 ub where behavior_type = 'buy'group by user_id ,item_id having count(*)>1order by 訂單量 desc;

一部分是復(fù)購(gòu)商品的信息

根據(jù)執(zhí)行結(jié)果,從所有成交訂單來(lái)看,有3187款商品被復(fù)購(gòu)。

五、總結(jié)與建議。

1、周末為高活躍、高成交時(shí)間,建議運(yùn)營(yíng)活動(dòng)的指定,運(yùn)營(yíng)策略的安排對(duì)該因素予以關(guān)注;

2、20到21點(diǎn)為每日高峰期,建議平臺(tái)與用戶做好人員安排和營(yíng)銷信息安排。

3、綜合商品信息進(jìn)一步挖掘表現(xiàn)突出的幾款商品及商品類目受歡迎的原因,以及對(duì)低成交的幾款商品進(jìn)行流失原因分析。

4、由點(diǎn)擊至加入購(gòu)物車亦或收藏的轉(zhuǎn)化太低,建議商家從商品詳情頁(yè)入手,做好商品詳情頁(yè)的優(yōu)化,提高用戶轉(zhuǎn)化;

5、構(gòu)建用戶價(jià)值評(píng)定體系,為平臺(tái)運(yùn)營(yíng)策略提供數(shù)據(jù)支持,實(shí)現(xiàn)精細(xì)化運(yùn)營(yíng)不同價(jià)值用戶。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容