行销(Marketing)里的有用的KPI
-
-
- Load the packages
- Load the dataset
- Change category variable to numeric 0 and 1
- Aggregate Conversion Rate
- Conversion Rates by Number of Campaigns
- Conversion Rates by Age
- Create Age Groups
- Conversion Rate by Age Group
- Conversions vs. Non-Conversions On Different Features
- Conversions by Age Groups & Marital Status
-
在这篇文章里我会用一个Kaggle的数据集来演示怎么计算行销学里比较有用的KPI计算。数据来源于 bank-additional-full.csv。这里我们着重讲数字行销(digital marketing)里比较重要的几个概念。例如,您可以基于个人归因逻辑,分析通过不同的社交网络服务(例如Facebook,LinkedIn和Instagram)产生的销售额。我们还可以分析通过此类营销渠道获得了多少客户,并查看各个数字营销活动的CPA和产生的价值。
- CTR (Click-through-rate): 点击率是查看看你的广告然后继续点击广告的用户所占的百分比。它可以衡量在线营销为网站带来流量方面的有效性
-
MQL (marketing qualified leads): 营销合格的潜在客户。这些符合市场营销条件的潜在客户(MQL)是可以根据其特征准备出售并符合特定业务标准以成为可能进行购买的客户的潜在客户。当开始营销这些合格的潜在客户时,我们还应该查看转化率。
-
Conversion Rate: 转换率可被定义为,采取所需行动的访客百分比,也可以理解为转化率是转化为活跃客户的潜在客户的百分比。当访客进入网站浏览并最终有透过点击行动呼吁(Call to action , CTA)按钮的方式,完成某个目的的比例,大多数人常会误会完成下单购买才可称为转换,但在不同形式的网站中,访客能为网站产生价值的方式不尽相同,转换的型态也不同。
如果我们想查看在网站上注册的潜在客户的百分比,则公式变为
下面是一个怎么用Python计算的例子
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory
import os
for dirname, _, filenames in os.walk('/kaggle/input'):
for filename in filenames:
print(os.path.join(dirname, filename))
# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All"
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
/kaggle/input/bank-marketing/bank-additional-full.csv
/kaggle/input/bank-marketing/bank-additional-names.txt
Load the packages
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
Load the dataset
df = pd.read_csv('../input/bank-marketing/bank-additional-full.csv', sep=';')
df.head(3)
age | job | marital | education | default | housing | loan | contact | month | day_of_week | ... | campaign | pdays | previous | poutcome | emp.var.rate | cons.price.idx | cons.conf.idx | euribor3m | nr.employed | y | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 56 | housemaid | married | basic.4y | no | no | no | telephone | may | mon | ... | 1 | 999 | 0 | nonexistent | 1.1 | 93.994 | -36.4 | 4.857 | 5191.0 | no |
1 | 57 | services | married | high.school | unknown | no | no | telephone | may | mon | ... | 1 | 999 | 0 | nonexistent | 1.1 | 93.994 | -36.4 | 4.857 | 5191.0 | no |
2 | 37 | services | married | high.school | no | yes | no | telephone | may | mon | ... | 1 | 999 | 0 | nonexistent | 1.1 | 93.994 | -36.4 | 4.857 | 5191.0 | no |
3 rows ?? 21 columns
Change category variable to numeric 0 and 1
df['conversion'] = df['y'].apply(lambda x: 1 if x == 'yes' else 0)
df.head(3)
age | job | marital | education | default | housing | loan | contact | month | day_of_week | ... | pdays | previous | poutcome | emp.var.rate | cons.price.idx | cons.conf.idx | euribor3m | nr.employed | y | conversion | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 56 | housemaid | married | basic.4y | no | no | no | telephone | may | mon | ... | 999 | 0 | nonexistent | 1.1 | 93.994 | -36.4 | 4.857 | 5191.0 | no | 0 |
1 | 57 | services | married | high.school | unknown | no | no | telephone | may | mon | ... | 999 | 0 | nonexistent | 1.1 | 93.994 | -36.4 | 4.857 | 5191.0 | no | 0 |
2 | 37 | services | married | high.school | no | yes | no | telephone | may | mon | ... | 999 | 0 | nonexistent | 1.1 | 93.994 | -36.4 | 4.857 | 5191.0 | no | 0 |
3 rows ?? 22 columns
Aggregate Conversion Rate
print('total conversions: %i out of %i' % (df.conversion.sum(), df.shape[0]))
print('conversion rate: %0.2f%%' % (df.conversion.