用户行为分析项目

理解数据

对用户行为的分析可以简单地理解为用户画像,关于我自己对用户画像的理解:

我们每个人都有自己的微信成员,给每一位成员打上3到n(n\geq3) 个不相同的标签,最后我们对这些标签进行汇总,统计,分析,其实就是简化的用户画像处理。以此,我们对以下用户行为数据进行几个不同维度的分析(维度的颗粒度适宜即可,无需过于细分,具体以各自业务为准)。

本文主要对以下数据进行分析,数据包含orderinfo表和userinfo表。其中orderinfo表含有539394条数据,5个字段;userinfo表含有101525条数据,3个字段。

涉及表的表结构如下:

  orderinfo  订单详情表

    | orderid     订单id

    | userid       用户id

    | isPaid       是否支付

    | price         付款价格

    | paidTime  付款时间

  userinfo  用户信息表

    | userid    用户id

    | sex        用户性别

    | birth      用户出生日期

数据来源于数据蛙。

本文主要从以下七个维度方面进行分析:

1、统计不同月份的下单人数。

2、统计用户三月份的回购率和复购率。

3、统计男女用户消费频次是否有差异。

4、统计多次消费的用户,第一次和最后一次消费间隔是多少天。

5、统计不同年龄段,用户的消费金额是否有差异。

6、统计消费的二八法则,消费的top20%用户,贡献了多少消费额。

 1、统计不同月份的下单人数

select 

        year(paidTime),

        month(paidTime),

        count(distinct userid) as cons

from orderinfo where isPaid = '已支付'

group by year(paidTime),month(paidTime);

不同月份下单人数统计表

将数据可视化

不同月份下单人数统计表

从上图得知,平均每月都有5万左右的人购买产品,数据主要涉及3,4月份。总体得知该数据的大致模型。

2、统计用户三月份的回购率和复购率

本月复购率:当月购买了多次的用户占当月用户的比例

本月回购率:本月购买用户中有多少用户下个月又再次购买

-- 复购率

with p as

(select

            userid,

            count(1) as cons

 from orderinfo where ispaid = '已支付' and month(paidTime) = '03'

group by userid)

select

        count(1) as userid_cons,

        sum(if(cons>1,1,0)) as fugou_cons,

        concat(round(sum(if(cons>1,1,0))/count(1)*100,2),'%') as fugou_rate

from p;

-- 逐步考虑逻辑如下:

a. 先筛选出3月份的消费情况

select

        *

from

orderinfo

where isPaid = '已支付'

and month(paidTime) = '03';

b. 统计一下每个用户在3月份消费了多少次

select

        userid,

        count(1) as cons

from

orderinfo

where isPaid = '已支付'

and month(paidTime) = '03'

group by userid;

c. 对购买次数做一个判断,统计出来那些消费了多次(大于1次)的用户数

with p as

(select

        userid,

        count(1) as cons

from

orderinfo

where isPaid = '已支付'

and month(paidTime) = '03'

group by userid

)

select

            count(1) as userid_cons,

            sum(if(cons>1,1,0)) as fugou_cons,

            sum(if(cons>1,1,0))/count(1) as fugou_rate

from p;

-- 3月回购率=3月用户中4月又再次购买的人数/3月的用户总数

with p as

(select

            userid,

            date_format(paidTime,'%Y-%m-01') as month_dt,

            count(1) as cons

from orderinfo

where isPaid = '已支付'

group by userid,date_format(paidTime,'%Y-%m-01'))

select

            count(a.userid),

            count(b.userid),

            count(b.userid)/count(a.userid) as huigou_rate

from (select * from p) a

left join (select * from p) b

on a.userid =  b.userid and date_sub(b.month_dt,interval 1 month) = a.month_dt

group by a.month_dt;

-- 分布逻辑:

a. 统计每年每月的一个用户消费情况

select

            userid,

            date_format(paidTime,'%Y-%m-01') as month_dt,

            count(1) as cons

from orderinfo

where isPaid = '已支付'

group by userid,date_format(paidTime,'%Y-%m-01')

b. 相邻月份进行关联,能关联上的用户说明就是回购

with p as

(select

            userid,

            date_format(paidTime,'%Y-%m-01') as month_dt,

            count(1) as cons

from orderinfo

where isPaid = '已支付'

group by userid,date_format(paidTime,'%Y-%m-01')

)

select

        *

from (select * from p) as a

left join (select * from p) as b

on a.userid = b.userid

and date_sub(b.month_dt,interval 1 month) = a.month_dt;

c、统计每个月份的消费人数情况即可得到回购率

with p as

(select

            userid,

            date_format(paidTime,'%Y-%m-01') as month_dt,

            count(1) as cons

from orderinfo

where isPaid = '已支付'

group by userid,date_format(paidTime,'%Y-%m-01')

)

select

            a.month_dt,

            count(a.userid),

            count(b.userid),

            count(b.userid)/count(a.userid) as huigou_rate

from (select * from p) as a

left join (select * from p) as b

on a.userid = b.userid

and date_sub(b.month_dt,interval 1 month) = a.month_dt

group by a.month_dt;

三月复购率统计
3,4,5月份的回购率统计

因为5月份数据统计量过于稀少,无法为分析提供足够的数据,因此单另分析三月份的回购率和复购率。对于30%的复购用户以及接近24%的回购用户,我们需要对他们进行特别关注且必须维护好,可将他们设置为一级用户。

3.统计男女用户消费频次是否有差异

with p as

(select

       a.userid,

       sex,

        count(1) as cons

from orderinfo a

inner join (select * from userinfo where sex != '') b

on a.userid = b.userid

group by a.userid,sex)

select

            sex,

            avg(cons) as avg_cons

from p

group by sex;

-- 分步逻辑

a、统计每个用户的消费次数,注意要带性别

select

              a.userid,

              sex,

              count(1) as cons

from orderinfo a

inner join (select * from userinfo where sex<>'') b

on a.userid=b.userid

group by a.userid,sex;

2、对性别做一个消费次数平均计算

with p as

(select

              a.userid,

              sex,

              count(1) as cons

from orderinfo a

inner join (select * from userinfo where sex<>'') b

on a.userid=b.userid

group by a.userid,sex

)

select

            sex,

              avg(cons) as avg_cons

from p

group by sex;

男女之间的消费频次统计

从上表我们得出:男女用户之间的消费频次没有差异,因此性别因素是不需要另外考虑的。

 4、统计多次消费的用户,第一次和最后一次消费间隔是多少天

a.取出多次消费的用户

select

            userid

from orderinfo

where isPaid = '已支付'

group by userid

having count(1)>1;

b.取出第一次和最后一次的时间

with p as

(select

            userid,

            min(paidTime),

            max(paidTime),

            datediff(max(paidTime),min(paidTime)) as time_interval

from orderinfo

where isPaid = '已支付'

group by userid

having count(1)>1

order by userid

)

select

            *,

            avg(time_interval) over() as avg_time_interval

from p;

用户消费最大时间间隔  

如上表,可以看出多次消费的用户最近消费时间和最早一次消费时间之间的差值,我们以消费时间差的平均值为统计标准,间隔大于16天的用户我们可以采用激励的措施(签到给金币,金币抵消部分RMB、购买优惠券等)吸引用户回归,间隔小于16天的用户我们可以采取更高的消费手段(满500减30,付费的落地页面更流畅等),以此吸收更大的流量用户。

5. 统计不同年龄段,用户的消费金额是否有差异

a. 计算每个用户的年龄,并对年龄进行分层(0-10:1,11-20:2,21-30:3)可以用case when。

select

            userid,

            birth,

            now(),

timestampdiff(year,birth,now()) as real_age,

ceil(timestampdiff(year,birth,now())/10) as age

from userinfo

where birth>'1901-00-00';

b. 关联订单信息,获取每个用户所在年龄段的消费频次和消费金额

with p as

(select

            userid,

            birth,

            now(),

            ceil(timestampdiff(year,birth,now())/10) as age

from userinfo

where birth>'1901-00-00'

)

select

            o.userid,

            age,

            count(1) as cons,

            sum(price) as prices

from orderinfo o

inner join p

on o.userid = p.userid

group by o.userid,age;

c、再对年龄分层进行聚合,得到不同年龄层的消费情况

select

            age,

            avg(cons) as avg_cons,

            avg(prices) as avg_prices

from

(with p as

(select

            userid,

            birth,

            now(),

            ceil(timestampdiff(year,birth,now())/10) as age

from userinfo

where birth>'1901-00-00'

)

select

            o.userid,

            age,

            count(1) as cons,

            sum(price) as prices

from orderinfo o

inner join p

on o.userid = p.userid

group by o.userid,age) a

group by age

order by age;

各年龄分层的消费频次和消费金额

从上表可得出,不同年龄段的消费者消费金额和消费频次之间是不同的,重点维护好3,4,5,6年龄阶段的人群,即20-50之间的人群,对这部分人的喜好,兴趣,购买时间等特征进行用户画像处理。

 6、统计消费的二八法则,消费的top20%用户,贡献了多少消费额

a、统计每个用户的消费金额,并进行一个降序排序

select

            userid,

            sum(price) as total_price

from orderinfo a

where isPaid = '已支付'

group by userid

order by total_price desc;

b、统计一下一共有多少用户,以及总消费金额是多少

select

              count(1) as cons,

              sum(total_price) as all_price

from (select

              userid,

              sum(price) as total_price

from orderinfo a

where isPaid="已支付"

group by userid) a;

c. 取出前20%的用户进行金额统计

select

              count(1) as cons,

              sum(total_price) as all_price

from (

select

              userid,

              sum(price) as total_price

from orderinfo a

where isPaid="已支付"

group by userid

order by total_price desc

limit 17000) b ;

总人数的总消费额
前20%的人数的消费额

select 2.7/3.18  -- 0.84906

20%的用户提供了85%的消费贡献量,要特别维护好前20%的用户,与上面5的做法一致,要做好用户维护。

结论

1. 总体数据显示3,4月份的购买用户量每月都有5万左右。

2. 从用户的复购率,回购率,性别影响,年龄分布影响,消费周期等几个不同的维度指标进行了用户行为分析和探讨,针对满足不同条件的用户进行不同的销售策略,力图达到精细化运营,以下分析结果可以帮助运营人员提供具体分析,提升他们的运营效率和业务增长:

2.1 对于30%的复购用户以及接近24%的回购用户,我们需要对他们进行重点关注,可以为这些用户进行push推送,提示减价信息等各种外部触发手段吸引用户;或者在页面内设置青铜、白银、黄金等各个等级的称号(可通过每日签到、消费金额进行升级)来鼓励用户前来消费。总之,使用各种手段,达到增加用户日活跃量(DAU)、品牌影响力和用户粘性(留存)这三个指标的效果。

2.2 男女用户之间的消费频次是没有差异,因此运营人员在考虑推送商品时不需要考虑男女性别问题,对用户都可以进行推荐促销。

2.3 进行多次购买的用户最近消费时间和最早一次消费时间之间的差值表现来看,以消费时间差的平均值为统计标准,间隔大于16天的用户我们可以采用激励的措施(签到给金币,金币抵消部分RMB、购买优惠券等)吸引用户回归,间隔小于16天的用户我们可以采取更高的消费手段(满500减30,付费的落地页面更流畅等),以此吸收更多的流量用户。

2.4 不同年龄段的消费者消费金额和消费频次之间是不同的,重点注重20-50之间的人群,对这部分人的喜好,兴趣,购买时间,购买时间间隔等细分特征进行更全面的用户画像处理。

2.5 进行了帕累托原则的应用,发现几乎符合前20%用户付出了80%的消费额的规则,因此要照顾好大R用户的需求。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,907评论 6 506
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,987评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,298评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,586评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,633评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,488评论 1 302
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,275评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,176评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,619评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,819评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,932评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,655评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,265评论 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,871评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,994评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,095评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,884评论 2 354

推荐阅读更多精彩内容