-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer-Acquisition-Cost.qmd
239 lines (198 loc) · 7.38 KB
/
Customer-Acquisition-Cost.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
---
title: Calculating Customer Acquisition Cost
author: Abdullah Mahmood
date: last-modified
format:
html:
theme: cosmo
css: quarto-style/style.css
highlight-style: atom-one
mainfont: Palatino
fontcolor: black
monobackgroundcolor: white
monofont: Menlo, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace
fontsize: 13pt
linestretch: 1.4
number-sections: true
number-depth: 5
toc: true
toc-location: right
toc-depth: 5
code-fold: false
code-copy: true
cap-location: bottom
format-links: false
embed-resources: true
anchor-sections: true
code-links:
- text: GitHub Repo
icon: github
href: https://github.com/abdullahau/customer-analytics/
- text: Quarto Markdown
icon: file-code
href: https://github.com/abdullahau/customer-analytics/blob/main/Customer-Acquisition-Cost.qmd
html-math-method:
method: mathjax
url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
---
Source: [Video Series - Customer Acquisition Cost (by Dan McCarthy)](https://www.youtube.com/watch?v=PZe6LUAyREQ)
## Doing the CACulation
*Main aspects to account for*
1. Repeat sales/marketing should be excluded from CAC
2. Lead-lag between spend and aquisition
3. CAC expense is more than ad spend
*Outline*
1. Unadjusted S&M CAC
2. Unadjusted Acquisition-related S&M CAC
3. Lag-adjusted Acquisition-related S&M CAC
4. Lag-adjusted Acquisition-related Total CAC
## Imports
```{python}
#| vscode: {languageId: python}
import pandas as pd
import matplotlib.pyplot as plt
%config InlineBackend.figure_formats = ['svg']
```
### Import Data
**Younger Eats**
Younger Eats is a fast-growing meal kit company, specializing in meals for young children.
#### Sales and Marketing Expense data (in *\$ Thousands*):
```{python}
#| vscode: {languageId: python}
# Sales and marketing expenses
snm_exp = pd.read_csv("data/CAC-data.csv")
snm_exp['Total Sales and Marketing'] = (
snm_exp.sum(axis=1) -
snm_exp['Acquisition-related onboarding expense'] -
snm_exp['Month']
)
snm_exp
```
The data contains the following channels:
- Referral Program
- TV Advertising
- Out-of-Home (OOH) Advertising / Outdoor Advertising
- New Customer Promotions
- Facebook Ads for Acquistion
- Facebook Ads for Repeat Orders
- Google Ads for Acquistion
- Google Ads for Repeat Orders
- Prospecting Sales Team
- Account Manager Team
- Acquistion-Related Onboarding Expense
We note the following features about the channels:
- *TV Ads*: Spend equally impacts customer acquisition in current and subsequent 3 months. 80% earmarked for customer acquisition.
- *OOH*: Spend equally impacts customer acquisition in current and subsequent 2 months. 80% earmarked for customer acquisition.
- *Prospecting Sales Team*: 3-month lag, on average, between sales activity and adoption
- *Account Manager Team*: This team facilitates transactions from existing accounts
- *Acquisition-Related Onboarding Expenses*: 2-month lead -- money is spent for customers acquired 2 months ago
#### Customer Acquistions Data (in *Thousands*) - Last Touch Attribution:
```{python}
#| vscode: {languageId: python}
# Acquisitions (last touch attribution)
acquisitions = pd.read_csv('data/CAC-Acquisition-Data.csv')
acquisitions['Total Acquisitions'] = (
acquisitions.sum(axis=1) -
acquisitions['Month']
)
acquisitions
```
## CAC Measurements
### Unadjusted Sales & Marketing CAC
Computed as *Total Sales & Marketing Cost / Total Acquisitions*
```{python}
#| vscode: {languageId: python}
# Unadjusted sales and marketing CAC
unadj_snm_cac = snm_exp['Total Sales and Marketing'][:-2] / acquisitions['Total Acquisitions']
unadj_snm_cac.name = "Unadjusted Sales & Marketing CAC"
unadj_snm_cac
```
```{python}
#| vscode: {languageId: python}
plt.bar(x=unadj_snm_cac.index+1, height=unadj_snm_cac, color='k', width=0.5)
plt.ylim(0, 100)
plt.xlabel('Month')
plt.ylabel('Customer Acquisition Cost ($)')
plt.title('Unadjusted Sales & Marketing CAC');
```
### Unadjusted Acquisition-related S&M CAC
Computed as *Unadjusted Acquisition-Related Sales & Marketing Cost / Total Acquisitions*
```{python}
#| vscode: {languageId: python}
# Unadjusted acquisition-related sales and marketing ($k)
unadj_acq_cost = (
snm_exp['Referral program (marketing)'] +
snm_exp['TV ads'] * 0.8 +
snm_exp['OOH'] * 0.8 +
snm_exp['New customer promotions (marketing)'] +
snm_exp['Facebook ads for acquisition'] +
snm_exp['Google ads for acquisition'] +
snm_exp['Prospecting sales team']
)
unadj_acq_cost.name = "Unadjusted Acquisition-related Sales & Marketing Cost"
unadj_acq_cost
```
```{python}
#| vscode: {languageId: python}
unadj_acq_cac = unadj_acq_cost[:-2] / acquisitions['Total Acquisitions']
unadj_acq_cac.name = "Unadjusted Acquisition-related Sales & Marketing CAC"
unadj_acq_cac
```
```{python}
#| vscode: {languageId: python}
plt.bar(x=unadj_acq_cac.index+1, height=unadj_acq_cac, color='k', width=0.5)
plt.ylim(0, 100)
plt.xlabel('Month')
plt.ylabel('Customer Acquisition Cost ($)')
plt.title('Unadjusted Acquisition-Related Sales & Marketing CAC');
```
### Lag-adjusted Acquisition-related S&M CAC
```{python}
#| vscode: {languageId: python}
# Lag-adjusted acquisition-related sales and marketing ($k)
lagadj_snm_cost = (
# Spend equally impacts customer acquisition in current and subsequent 3 months. 80% earmarked for customer acquisition.
snm_exp['TV ads'].shift(periods=[0, 1, 2, 3]).sum(axis=1) / 4 * 0.8 +
# Spend equally impacts customer acquisition in current and subsequent 2 months. 80% earmarked for customer acquisition.
snm_exp['OOH'].shift(periods=[0, 1, 2]).sum(axis=1) / 3 * 0.8 +
# 3-month lag, on average, between sales activity and adoption
snm_exp['Prospecting sales team'].shift(periods=3) +
snm_exp['Referral program (marketing)'] +
snm_exp['New customer promotions (marketing)'] +
snm_exp['Facebook ads for acquisition'] +
snm_exp['Google ads for acquisition']
)
lagadj_snm_cac = lagadj_snm_cost / acquisitions['Total Acquisitions']
lagadj_snm_cac.dropna()
```
```{python}
#| vscode: {languageId: python}
plt.plot(unadj_acq_cac.index+1, unadj_acq_cac, 'k', label='Unadjusted Acquisition-related S&M CAC')
plt.plot(lagadj_snm_cac.index+1, lagadj_snm_cac, 'k--', label='Lag-adjusted Acquisition-related S&M CAC')
plt.ylim(32, 46)
plt.legend()
plt.xlabel('Month')
plt.ylabel('Customer Acquisition Cost ($)')
plt.title('Lag-Adjusted Vs. Unadjusted S&M CAC');
```
### Lag-adjusted Acquisition-related Total CAC
```{python}
#| vscode: {languageId: python}
lagadj_total_cost = (
# 2-month lead -- money is spent for customers acquired 2 months ago
snm_exp['Acquisition-related onboarding expense'].shift(periods=-2) +
lagadj_snm_cost
)
lagadj_total_cac = lagadj_total_cost / acquisitions['Total Acquisitions']
lagadj_total_cac.dropna()
```
```{python}
#| vscode: {languageId: python}
plt.plot(lagadj_snm_cac.index+1, lagadj_snm_cac, 'k', label='Lag-adjusted Acquisition-related S&M CAC')
plt.plot(lagadj_total_cac.index+1, lagadj_total_cac, 'k--', label='Lag-adjusted Acquisition-related Total CAC')
plt.ylim(0, 80)
plt.legend()
plt.xlabel('Month')
plt.ylabel('Customer Acquisition Cost ($)')
plt.title('Lag-Adjusted S&M Vs. Total CAC');
```