@cuemath/web-utils 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants/index.d.ts +1 -0
- package/dist/cjs/constants/index.js +1 -0
- package/dist/cjs/constants/index.js.map +1 -1
- package/dist/cjs/constants/instrumentation/index.d.ts +5 -0
- package/dist/cjs/constants/instrumentation/index.js +9 -0
- package/dist/cjs/constants/instrumentation/index.js.map +1 -0
- package/dist/cjs/data/utm-source.json +52 -0
- package/dist/cjs/growth-source/index.d.ts +11 -3
- package/dist/cjs/growth-source/index.js +59 -104
- package/dist/cjs/growth-source/index.js.map +1 -1
- package/dist/cjs/growth-source/scripts/source-channel.d.ts +1 -0
- package/dist/cjs/growth-source/scripts/source-channel.js +44 -0
- package/dist/cjs/growth-source/scripts/source-channel.js.map +1 -0
- package/dist/cjs/growth-source/types.d.ts +20 -2
- package/dist/cjs/website-category/utils/instrumentation.d.ts +1 -1
- package/dist/esm/constants/index.d.ts +1 -0
- package/dist/esm/constants/index.js +1 -0
- package/dist/esm/constants/index.js.map +1 -1
- package/dist/esm/constants/instrumentation/index.d.ts +5 -0
- package/dist/esm/constants/instrumentation/index.js +6 -0
- package/dist/esm/constants/instrumentation/index.js.map +1 -0
- package/dist/esm/data/utm-source.json +52 -0
- package/dist/esm/growth-source/index.d.ts +11 -3
- package/dist/esm/growth-source/index.js +54 -94
- package/dist/esm/growth-source/index.js.map +1 -1
- package/dist/esm/growth-source/scripts/source-channel.d.ts +1 -0
- package/dist/esm/growth-source/scripts/source-channel.js +44 -0
- package/dist/esm/growth-source/scripts/source-channel.js.map +1 -0
- package/dist/esm/growth-source/types.d.ts +20 -2
- package/dist/esm/website-category/utils/instrumentation.d.ts +1 -1
- package/package.json +5 -2
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./country"), exports);
|
|
18
18
|
__exportStar(require("./date-time"), exports);
|
|
19
19
|
__exportStar(require("./currency-symbols"), exports);
|
|
20
|
+
__exportStar(require("./instrumentation"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,oDAAkC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REVENUE_CHANNEL = exports.REFERRAL_PAGE_PATH = void 0;
|
|
4
|
+
exports.REFERRAL_PAGE_PATH = ['gift/invite/', 'gift/referral/'];
|
|
5
|
+
exports.REVENUE_CHANNEL = {
|
|
6
|
+
REFERRAL: 'referral',
|
|
7
|
+
ORGANIC: 'organic',
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/constants/instrumentation/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AAExD,QAAA,eAAe,GAAG;IAC7B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Affiliate": "paid_affiliate_others",
|
|
3
|
+
"D_g": "paid_ad_google",
|
|
4
|
+
"d_fb_m": "paid_ad_fb",
|
|
5
|
+
"d_sem_m": "paid_ad_google",
|
|
6
|
+
"D_s": "paid_ad_google",
|
|
7
|
+
"dr_fb_m": "paid_ad_fb",
|
|
8
|
+
"system": "referral_others",
|
|
9
|
+
"dc_fb_m": "paid_ad_fb",
|
|
10
|
+
"dr_sem_m": "paid_ad_google",
|
|
11
|
+
"dc_sem_m": "paid_ad_google",
|
|
12
|
+
"CUEMATHAPP": "organic",
|
|
13
|
+
"CUETEACHERAPP": "organic",
|
|
14
|
+
"IM": "paid_affiliate_bp_influencer",
|
|
15
|
+
"la": "referral_parent",
|
|
16
|
+
"social": "organic_social",
|
|
17
|
+
"website": "Organic",
|
|
18
|
+
"google": "paid_ad_biddables",
|
|
19
|
+
"CUEMATH": "organic",
|
|
20
|
+
"SocialMedia": "Organic_social",
|
|
21
|
+
"d_apex": "paid_affiliate_others",
|
|
22
|
+
"D-Social": "Organic_social",
|
|
23
|
+
"ORM": "paid_affiliate_bp_influencer",
|
|
24
|
+
"d_disc_m": "paid_ad_google",
|
|
25
|
+
"Facebook": "organic_facebook",
|
|
26
|
+
"gbl": "organic_gbl",
|
|
27
|
+
"youtube": "organic_social",
|
|
28
|
+
"offline_community": "offline_events",
|
|
29
|
+
"cj": "paid_affiliate_others",
|
|
30
|
+
"D_email": "organic_email",
|
|
31
|
+
"dc_disc_m": "paid_ad_google",
|
|
32
|
+
"affiliate-brainly": "paid_affiliate_others",
|
|
33
|
+
"Offline_Event_UAE_Local": "offline_events",
|
|
34
|
+
"CE-Messenger": "organic_Messenger",
|
|
35
|
+
"CE-Inbound": "organic_inbound",
|
|
36
|
+
"CE-Instagram": "organic_insta",
|
|
37
|
+
"referral": "referral_others",
|
|
38
|
+
"d_momentus": "paid_affiliate_others",
|
|
39
|
+
"promotion_mushrif_mall_QR_Code": "offline_events",
|
|
40
|
+
"affiliate-bark": "paid_affiliate_others",
|
|
41
|
+
"PAID-EXP": "paid_ad_biddables",
|
|
42
|
+
"utm_source": "test",
|
|
43
|
+
"email": "organic_email",
|
|
44
|
+
"PAID-EXP-AUS": "paid_ad_biddables",
|
|
45
|
+
"d_opicle": "paid_affiliate_others",
|
|
46
|
+
"REFERRAL": "referral_others",
|
|
47
|
+
"Old Leads": "others",
|
|
48
|
+
"Outbound Phone call": "organic_outbound",
|
|
49
|
+
"chatbot": "organic",
|
|
50
|
+
"d_magixengage": "paid_affiliate_others",
|
|
51
|
+
"CE-Info": "organic_info"
|
|
52
|
+
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import type { SourceDetails, SourceDetailsCookie, Platform, SignupFlow,
|
|
1
|
+
import type { SourceDetails, SourceDetailsCookie, Platform, SignupFlow, SignupForm, RevenueChannel } from './types';
|
|
2
2
|
export declare const readSourceCookie: () => SourceDetailsCookie;
|
|
3
3
|
export declare const isSourcePresent: () => boolean;
|
|
4
|
-
export declare const initSourceDetails: ({ platform, experiments, flow, affiliateChannel, offlineChannel,
|
|
4
|
+
export declare const initSourceDetails: ({ platform, experiments, flow, affiliateChannel, offlineChannel, pageProfile, performanceChannel, revenueChannel, salesProcess, guestId, landingPage, referrer, sourceChannel, }: SourceDetails) => Promise<void>;
|
|
5
5
|
export declare const setLastPage: (pagePath: string) => Promise<void>;
|
|
6
6
|
export declare const setFlowEntryPoint: (flowEntry: string) => Promise<void>;
|
|
7
7
|
export declare const setFlow: (flow: SignupFlow) => Promise<void>;
|
|
8
|
-
export declare const setOrganicChannel: (organicChannel: OrganicChannel) => Promise<void>;
|
|
9
8
|
export declare const setRevenueChannel: (revenueChannel: RevenueChannel) => Promise<void>;
|
|
10
9
|
export declare const setSalesProcess: (salesProcess: string) => Promise<void>;
|
|
11
10
|
export declare const clearSalesProcess: () => Promise<void>;
|
|
12
11
|
export declare const updateGuestId: (guestId: string) => Promise<void>;
|
|
13
12
|
export declare const setFirstPage: (pagePath: string) => Promise<void>;
|
|
14
13
|
export declare const setPlatformChannel: (platformChannel: Platform) => Promise<void>;
|
|
14
|
+
export declare const setLandingPage: (landingPage: string) => Promise<void>;
|
|
15
|
+
export declare const setReferrer: (referrer: string) => Promise<void>;
|
|
16
|
+
export declare const setSourceChannel: (sourceChannel: string) => Promise<void>;
|
|
17
|
+
export declare const setSubPlatform: (subPlatform: string) => Promise<void>;
|
|
18
|
+
export declare const setCurrentPage: (currentPage: string) => Promise<void>;
|
|
19
|
+
export declare const setPageProfile: (pageProfile: string) => Promise<void>;
|
|
20
|
+
export declare const setSignupForm: (signupForm: SignupForm) => Promise<void>;
|
|
21
|
+
export declare const clearSignupForm: () => Promise<void>;
|
|
22
|
+
export declare const getSourceChannel: (utmSource: string) => string;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setPlatformChannel = exports.setFirstPage = exports.updateGuestId = exports.clearSalesProcess = exports.setSalesProcess = exports.setRevenueChannel = exports.
|
|
6
|
+
exports.getSourceChannel = exports.clearSignupForm = exports.setSignupForm = exports.setPageProfile = exports.setCurrentPage = exports.setSubPlatform = exports.setSourceChannel = exports.setReferrer = exports.setLandingPage = exports.setPlatformChannel = exports.setFirstPage = exports.updateGuestId = exports.clearSalesProcess = exports.setSalesProcess = exports.setRevenueChannel = exports.setFlow = exports.setFlowEntryPoint = exports.setLastPage = exports.initSourceDetails = exports.isSourcePresent = exports.readSourceCookie = void 0;
|
|
4
7
|
const cookie_1 = require("../cookie");
|
|
8
|
+
const utm_source_json_1 = __importDefault(require("../data/utm-source.json"));
|
|
5
9
|
const url_parser_1 = require("../url-parser");
|
|
6
10
|
const SOURCE_DETAILS_COOKIE = 'source_details';
|
|
7
|
-
const UTM_PARAMS = [
|
|
8
|
-
'utm_source',
|
|
9
|
-
'utm_medium',
|
|
10
|
-
'utm_campaign',
|
|
11
|
-
'utm_term',
|
|
12
|
-
];
|
|
13
11
|
const readSourceCookie = () => {
|
|
14
12
|
const sourceDetails = (0, cookie_1.getCookie)(SOURCE_DETAILS_COOKIE);
|
|
15
13
|
return sourceDetails ? JSON.parse(decodeURIComponent(sourceDetails)) : undefined;
|
|
@@ -26,34 +24,21 @@ const updateSourceCookie = (sourceDetail) => {
|
|
|
26
24
|
if (!(0, exports.isSourcePresent)())
|
|
27
25
|
return;
|
|
28
26
|
const sourceDetails = (0, exports.readSourceCookie)();
|
|
27
|
+
const { current = {}, ...restAttributes } = sourceDetails || {};
|
|
29
28
|
const updatedDetails = {
|
|
30
29
|
...sourceDetails,
|
|
31
|
-
|
|
30
|
+
current: !current
|
|
31
|
+
? { ...restAttributes, ...sourceDetail } // Copy FTP attributes for the first time
|
|
32
|
+
: { ...current, ...sourceDetail }, // Update current attributes when already created
|
|
32
33
|
};
|
|
33
34
|
writeSourceCookie(updatedDetails);
|
|
34
35
|
};
|
|
35
|
-
const getRevenueChannel = (platform
|
|
36
|
+
const getRevenueChannel = (platform) => {
|
|
36
37
|
let revenueChannel = 'unknown';
|
|
37
38
|
// set defaults for WEBSITE and ASTRO
|
|
38
39
|
if (platform === 'website') {
|
|
39
40
|
revenueChannel = 'organic';
|
|
40
41
|
}
|
|
41
|
-
if (utmSource) {
|
|
42
|
-
switch (true) {
|
|
43
|
-
case /^affiliate-/.test(utmSource):
|
|
44
|
-
revenueChannel = 'affiliate';
|
|
45
|
-
break;
|
|
46
|
-
case /^offline-/.test(utmSource):
|
|
47
|
-
revenueChannel = 'offline';
|
|
48
|
-
break;
|
|
49
|
-
case /^referral-/.test(utmSource):
|
|
50
|
-
revenueChannel = 'referral';
|
|
51
|
-
break;
|
|
52
|
-
case /^performance-/.test(utmSource):
|
|
53
|
-
revenueChannel = 'performance';
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
42
|
return revenueChannel;
|
|
58
43
|
};
|
|
59
44
|
/*
|
|
@@ -72,115 +57,47 @@ const getFlow = (platform, experiments) => {
|
|
|
72
57
|
}
|
|
73
58
|
return flow;
|
|
74
59
|
};
|
|
75
|
-
const getUTMParams = () => {
|
|
76
|
-
if (typeof window === undefined)
|
|
77
|
-
return {};
|
|
78
|
-
const search = new URLSearchParams(window.location.search);
|
|
79
|
-
const utmParams = UTM_PARAMS.reduce((acc, param) => {
|
|
80
|
-
const utmParam = search.get(param);
|
|
81
|
-
if (utmParam) {
|
|
82
|
-
acc[param] = utmParam;
|
|
83
|
-
}
|
|
84
|
-
return acc;
|
|
85
|
-
}, {});
|
|
86
|
-
return utmParams;
|
|
87
|
-
};
|
|
88
60
|
const getFirstPage = () => {
|
|
89
61
|
if (typeof window === undefined)
|
|
90
62
|
return '';
|
|
91
63
|
return (0, url_parser_1.removeHrefLangFromPath)(window.location.pathname);
|
|
92
64
|
};
|
|
93
|
-
/* TODO: Align Marketing Team on UTM source convention
|
|
94
|
-
affiliate-<channel>
|
|
95
|
-
performance-<channel>
|
|
96
|
-
organic-<channel>
|
|
97
|
-
offline-<channel>
|
|
98
|
-
*/
|
|
99
|
-
const getChannel = (utmSource) => {
|
|
100
|
-
// TODO: UTM source patter for FB, GOOGLE...
|
|
101
|
-
if (!utmSource)
|
|
102
|
-
return '';
|
|
103
|
-
let channel = '';
|
|
104
|
-
if (utmSource) {
|
|
105
|
-
switch (true) {
|
|
106
|
-
case /^affiliate-/.test(utmSource):
|
|
107
|
-
case /^offline-/.test(utmSource):
|
|
108
|
-
case /^referral-/.test(utmSource):
|
|
109
|
-
case /^performance-/.test(utmSource):
|
|
110
|
-
channel = utmSource.split('-')[1];
|
|
111
|
-
break;
|
|
112
|
-
default:
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return channel;
|
|
117
|
-
};
|
|
118
65
|
/*
|
|
119
66
|
Set Static Source Details of user on Visit of Platform
|
|
120
67
|
*/
|
|
121
68
|
const initSourceDetails = async ({ platform, experiments, // only for website.
|
|
122
|
-
flow, affiliateChannel, offlineChannel,
|
|
123
|
-
const utmParams = getUTMParams();
|
|
124
|
-
const { utm_source: utmSource } = utmParams;
|
|
125
|
-
const leadChannel = getChannel(utmSource);
|
|
69
|
+
flow, affiliateChannel, offlineChannel, pageProfile, performanceChannel, revenueChannel, salesProcess, guestId, landingPage, referrer, sourceChannel, }) => {
|
|
126
70
|
/*
|
|
127
71
|
source cookie was added in cross subdomain for few days initially,
|
|
128
72
|
which was later changed to subdomain specific. Now to sending older cookie to backend, removing older cookie
|
|
129
73
|
*/
|
|
130
74
|
(0, cookie_1.removeCookie)(SOURCE_DETAILS_COOKIE, true);
|
|
131
|
-
revenueChannel = revenueChannel || getRevenueChannel(platform
|
|
132
|
-
if (utmSource) {
|
|
133
|
-
switch (revenueChannel) {
|
|
134
|
-
case 'affiliate':
|
|
135
|
-
affiliateChannel = affiliateChannel || leadChannel;
|
|
136
|
-
break;
|
|
137
|
-
case 'offline':
|
|
138
|
-
offlineChannel = offlineChannel || leadChannel;
|
|
139
|
-
break;
|
|
140
|
-
case 'organic':
|
|
141
|
-
organicChannel = organicChannel || leadChannel;
|
|
142
|
-
break;
|
|
143
|
-
case 'performance':
|
|
144
|
-
performanceChannel = performanceChannel || leadChannel;
|
|
145
|
-
break;
|
|
146
|
-
default:
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
75
|
+
revenueChannel = revenueChannel || getRevenueChannel(platform);
|
|
150
76
|
if (!(0, exports.isSourcePresent)()) {
|
|
151
77
|
const sourceDetails = {
|
|
152
78
|
platform_channel: platform,
|
|
153
79
|
experiment_dict: experiments,
|
|
154
|
-
utm_params: utmParams,
|
|
155
80
|
flow: flow || getFlow(platform, experiments),
|
|
156
81
|
affiliate_channel: affiliateChannel,
|
|
157
82
|
offline_channel: offlineChannel,
|
|
158
|
-
|
|
83
|
+
page_profile: pageProfile,
|
|
159
84
|
performance_channel: performanceChannel,
|
|
160
85
|
revenue_channel: revenueChannel,
|
|
161
86
|
first_page: getFirstPage(),
|
|
162
87
|
sales_process: salesProcess,
|
|
163
88
|
guest_id: guestId,
|
|
89
|
+
landing_page: landingPage,
|
|
90
|
+
referrer,
|
|
91
|
+
source_channel: sourceChannel,
|
|
164
92
|
};
|
|
165
93
|
writeSourceCookie(sourceDetails);
|
|
166
94
|
}
|
|
167
95
|
else {
|
|
168
|
-
|
|
96
|
+
const updatedSource = {
|
|
169
97
|
experiment_dict: experiments,
|
|
170
98
|
flow: flow || getFlow(platform, experiments),
|
|
171
99
|
guest_id: guestId,
|
|
172
100
|
};
|
|
173
|
-
if (utmSource) {
|
|
174
|
-
updatedSource = {
|
|
175
|
-
...updatedSource,
|
|
176
|
-
utm_params: utmParams,
|
|
177
|
-
affiliate_channel: affiliateChannel,
|
|
178
|
-
offline_channel: offlineChannel,
|
|
179
|
-
organic_channel: organicChannel,
|
|
180
|
-
performance_channel: performanceChannel,
|
|
181
|
-
revenue_channel: revenueChannel,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
101
|
updateSourceCookie(updatedSource);
|
|
185
102
|
}
|
|
186
103
|
};
|
|
@@ -200,10 +117,6 @@ const setFlow = async (flow) => {
|
|
|
200
117
|
updateSourceCookie({ flow });
|
|
201
118
|
};
|
|
202
119
|
exports.setFlow = setFlow;
|
|
203
|
-
const setOrganicChannel = async (organicChannel) => {
|
|
204
|
-
updateSourceCookie({ organic_channel: organicChannel });
|
|
205
|
-
};
|
|
206
|
-
exports.setOrganicChannel = setOrganicChannel;
|
|
207
120
|
const setRevenueChannel = async (revenueChannel) => {
|
|
208
121
|
updateSourceCookie({ revenue_channel: revenueChannel });
|
|
209
122
|
};
|
|
@@ -228,4 +141,46 @@ const setPlatformChannel = async (platformChannel) => {
|
|
|
228
141
|
updateSourceCookie({ platform_channel: platformChannel });
|
|
229
142
|
};
|
|
230
143
|
exports.setPlatformChannel = setPlatformChannel;
|
|
144
|
+
const setLandingPage = async (landingPage) => {
|
|
145
|
+
updateSourceCookie({ landing_page: landingPage });
|
|
146
|
+
};
|
|
147
|
+
exports.setLandingPage = setLandingPage;
|
|
148
|
+
const setReferrer = async (referrer) => {
|
|
149
|
+
updateSourceCookie({ referrer });
|
|
150
|
+
};
|
|
151
|
+
exports.setReferrer = setReferrer;
|
|
152
|
+
const setSourceChannel = async (sourceChannel) => {
|
|
153
|
+
updateSourceCookie({ source_channel: sourceChannel });
|
|
154
|
+
};
|
|
155
|
+
exports.setSourceChannel = setSourceChannel;
|
|
156
|
+
const setSubPlatform = async (subPlatform) => {
|
|
157
|
+
updateSourceCookie({ sub_platform: subPlatform });
|
|
158
|
+
};
|
|
159
|
+
exports.setSubPlatform = setSubPlatform;
|
|
160
|
+
const setCurrentPage = async (currentPage) => {
|
|
161
|
+
updateSourceCookie({ current_page: currentPage });
|
|
162
|
+
};
|
|
163
|
+
exports.setCurrentPage = setCurrentPage;
|
|
164
|
+
const setPageProfile = async (pageProfile) => {
|
|
165
|
+
updateSourceCookie({ page_profile: pageProfile });
|
|
166
|
+
};
|
|
167
|
+
exports.setPageProfile = setPageProfile;
|
|
168
|
+
const setSignupForm = async (signupForm) => {
|
|
169
|
+
updateSourceCookie({ signup_form: signupForm });
|
|
170
|
+
};
|
|
171
|
+
exports.setSignupForm = setSignupForm;
|
|
172
|
+
const clearSignupForm = async () => {
|
|
173
|
+
updateSourceCookie({ signup_form: {} });
|
|
174
|
+
};
|
|
175
|
+
exports.clearSignupForm = clearSignupForm;
|
|
176
|
+
const getSourceChannel = (utmSource) => {
|
|
177
|
+
const utmSourceMap = {
|
|
178
|
+
...utm_source_json_1.default,
|
|
179
|
+
};
|
|
180
|
+
if (utmSourceMap[utmSource]) {
|
|
181
|
+
return utmSourceMap[utmSource];
|
|
182
|
+
}
|
|
183
|
+
return 'Others';
|
|
184
|
+
};
|
|
185
|
+
exports.getSourceChannel = getSourceChannel;
|
|
231
186
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/growth-source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grow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gBAAgB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC5D,MAAM,YAAY,GAEd;QACF,GAAG,yBAA0B;KAC9B,CAAC;IAEF,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE;QAC3B,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;KAChC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const csv = require('papaparse');
|
|
6
|
+
const ClusterMetaInfoFileName = 'utm-source';
|
|
7
|
+
(function csvFileToJSON() {
|
|
8
|
+
const INPUT_FILE_PATH = path.resolve(__dirname, '.', `../../data/${ClusterMetaInfoFileName}.csv`);
|
|
9
|
+
const OUTPUT_FILE_PATH = path.resolve(__dirname, '.', `../../data/${ClusterMetaInfoFileName}.json`);
|
|
10
|
+
try {
|
|
11
|
+
fs.readFile(INPUT_FILE_PATH, 'utf-8', (err, data) => {
|
|
12
|
+
if (err)
|
|
13
|
+
throw err;
|
|
14
|
+
const options = {
|
|
15
|
+
header: true,
|
|
16
|
+
delimiter: ',',
|
|
17
|
+
quoteChar: '"',
|
|
18
|
+
escapeChar: '\\',
|
|
19
|
+
};
|
|
20
|
+
const jsonObj = csv.parse(data, options).data;
|
|
21
|
+
let sourceChannelData = {};
|
|
22
|
+
jsonObj.forEach(utmSourceChannelObject => {
|
|
23
|
+
const { utm_source: utmSource, source_channel: sourceChannel } = utmSourceChannelObject || {};
|
|
24
|
+
if (sourceChannelData[utmSource]) {
|
|
25
|
+
throw new Error(`Duplicate utm_source Found ${utmSource}`);
|
|
26
|
+
}
|
|
27
|
+
sourceChannelData[utmSource] = sourceChannel;
|
|
28
|
+
});
|
|
29
|
+
const jsonString = JSON.stringify(sourceChannelData, null, 2);
|
|
30
|
+
fs.writeFile(OUTPUT_FILE_PATH, jsonString, e => {
|
|
31
|
+
if (e)
|
|
32
|
+
throw e;
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log('CSV file converted to JSON');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.log(err);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
//# sourceMappingURL=source-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-channel.js","sourceRoot":"","sources":["../../../../src/growth-source/scripts/source-channel.js"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEjC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C,CAAC,SAAS,aAAa;IACrB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAClC,SAAS,EACT,GAAG,EACH,cAAc,uBAAuB,MAAM,CAC5C,CAAC;IACF,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CACnC,SAAS,EACT,GAAG,EACH,cAAc,uBAAuB,OAAO,CAC7C,CAAC;IAEF,IAAI;QACF,EAAE,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAClD,IAAI,GAAG;gBAAE,MAAM,GAAG,CAAC;YAEnB,MAAM,OAAO,GAAG;gBACd,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,GAAG;gBACd,SAAS,EAAE,GAAG;gBACd,UAAU,EAAE,IAAI;aACjB,CAAC;YACF,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;YAE9C,IAAI,iBAAiB,GAAG,EAAE,CAAC;YAE3B,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;gBACvC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,GAC5D,sBAAsB,IAAI,EAAE,CAAC;gBAE/B,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;oBAChC,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;iBAC5D;gBAED,iBAAiB,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC;YAC/C,CAAC,CAAC,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAE9D,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE;gBAC7C,IAAI,CAAC;oBAAE,MAAM,CAAC,CAAC;gBACf,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -9,8 +9,15 @@ export type UTMParams = {
|
|
|
9
9
|
utm_medium?: string;
|
|
10
10
|
utm_campaign?: string;
|
|
11
11
|
utm_term?: string;
|
|
12
|
+
utm_content?: string;
|
|
13
|
+
utm_adcontent?: string;
|
|
12
14
|
};
|
|
13
15
|
export type UTMParamsKeys = keyof UTMParams;
|
|
16
|
+
export type SignupForm = {
|
|
17
|
+
form_id?: string;
|
|
18
|
+
product?: string;
|
|
19
|
+
process?: string;
|
|
20
|
+
};
|
|
14
21
|
export type SourceDetailsCookie = {
|
|
15
22
|
platform_channel: Platform;
|
|
16
23
|
experiment_dict?: Experiments;
|
|
@@ -20,12 +27,19 @@ export type SourceDetailsCookie = {
|
|
|
20
27
|
offline_channel?: string;
|
|
21
28
|
performance_channel?: string;
|
|
22
29
|
revenue_channel: RevenueChannel;
|
|
23
|
-
organic_channel?: string;
|
|
24
30
|
flow_entry?: string;
|
|
25
31
|
first_page?: string;
|
|
26
32
|
last_page?: string;
|
|
27
33
|
sales_process?: string;
|
|
28
34
|
guest_id?: string;
|
|
35
|
+
current?: Partial<SourceDetailsCookie>;
|
|
36
|
+
landing_page?: string;
|
|
37
|
+
referrer?: string;
|
|
38
|
+
source_channel?: string;
|
|
39
|
+
page_profile?: string;
|
|
40
|
+
sub_platform?: string;
|
|
41
|
+
current_page?: string;
|
|
42
|
+
signup_form?: SignupForm;
|
|
29
43
|
};
|
|
30
44
|
export type SourceDetails = {
|
|
31
45
|
platform: Platform;
|
|
@@ -36,10 +50,14 @@ export type SourceDetails = {
|
|
|
36
50
|
offlineChannel?: string;
|
|
37
51
|
performanceChannel?: string;
|
|
38
52
|
revenueChannel: RevenueChannel;
|
|
39
|
-
organicChannel?: string;
|
|
40
53
|
flowEntry?: string;
|
|
41
54
|
firstPage?: string;
|
|
42
55
|
lastPage?: string;
|
|
43
56
|
guestId?: string;
|
|
44
57
|
salesProcess?: string;
|
|
58
|
+
landingPage?: string;
|
|
59
|
+
referrer?: string;
|
|
60
|
+
sourceChannel?: string;
|
|
61
|
+
pageProfile?: string;
|
|
62
|
+
subPlatform?: string;
|
|
45
63
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getTopicName: (path: string) => any;
|
|
2
|
-
export declare function getSubRevenueChannel(pathname?: string): "Brand" | "Intent" | "Supply" | "Referral" | "Content"
|
|
2
|
+
export declare function getSubRevenueChannel(pathname?: string): "Others" | "Brand" | "Intent" | "Supply" | "Referral" | "Content";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/constants/instrumentation/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Affiliate": "paid_affiliate_others",
|
|
3
|
+
"D_g": "paid_ad_google",
|
|
4
|
+
"d_fb_m": "paid_ad_fb",
|
|
5
|
+
"d_sem_m": "paid_ad_google",
|
|
6
|
+
"D_s": "paid_ad_google",
|
|
7
|
+
"dr_fb_m": "paid_ad_fb",
|
|
8
|
+
"system": "referral_others",
|
|
9
|
+
"dc_fb_m": "paid_ad_fb",
|
|
10
|
+
"dr_sem_m": "paid_ad_google",
|
|
11
|
+
"dc_sem_m": "paid_ad_google",
|
|
12
|
+
"CUEMATHAPP": "organic",
|
|
13
|
+
"CUETEACHERAPP": "organic",
|
|
14
|
+
"IM": "paid_affiliate_bp_influencer",
|
|
15
|
+
"la": "referral_parent",
|
|
16
|
+
"social": "organic_social",
|
|
17
|
+
"website": "Organic",
|
|
18
|
+
"google": "paid_ad_biddables",
|
|
19
|
+
"CUEMATH": "organic",
|
|
20
|
+
"SocialMedia": "Organic_social",
|
|
21
|
+
"d_apex": "paid_affiliate_others",
|
|
22
|
+
"D-Social": "Organic_social",
|
|
23
|
+
"ORM": "paid_affiliate_bp_influencer",
|
|
24
|
+
"d_disc_m": "paid_ad_google",
|
|
25
|
+
"Facebook": "organic_facebook",
|
|
26
|
+
"gbl": "organic_gbl",
|
|
27
|
+
"youtube": "organic_social",
|
|
28
|
+
"offline_community": "offline_events",
|
|
29
|
+
"cj": "paid_affiliate_others",
|
|
30
|
+
"D_email": "organic_email",
|
|
31
|
+
"dc_disc_m": "paid_ad_google",
|
|
32
|
+
"affiliate-brainly": "paid_affiliate_others",
|
|
33
|
+
"Offline_Event_UAE_Local": "offline_events",
|
|
34
|
+
"CE-Messenger": "organic_Messenger",
|
|
35
|
+
"CE-Inbound": "organic_inbound",
|
|
36
|
+
"CE-Instagram": "organic_insta",
|
|
37
|
+
"referral": "referral_others",
|
|
38
|
+
"d_momentus": "paid_affiliate_others",
|
|
39
|
+
"promotion_mushrif_mall_QR_Code": "offline_events",
|
|
40
|
+
"affiliate-bark": "paid_affiliate_others",
|
|
41
|
+
"PAID-EXP": "paid_ad_biddables",
|
|
42
|
+
"utm_source": "test",
|
|
43
|
+
"email": "organic_email",
|
|
44
|
+
"PAID-EXP-AUS": "paid_ad_biddables",
|
|
45
|
+
"d_opicle": "paid_affiliate_others",
|
|
46
|
+
"REFERRAL": "referral_others",
|
|
47
|
+
"Old Leads": "others",
|
|
48
|
+
"Outbound Phone call": "organic_outbound",
|
|
49
|
+
"chatbot": "organic",
|
|
50
|
+
"d_magixengage": "paid_affiliate_others",
|
|
51
|
+
"CE-Info": "organic_info"
|
|
52
|
+
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import type { SourceDetails, SourceDetailsCookie, Platform, SignupFlow,
|
|
1
|
+
import type { SourceDetails, SourceDetailsCookie, Platform, SignupFlow, SignupForm, RevenueChannel } from './types';
|
|
2
2
|
export declare const readSourceCookie: () => SourceDetailsCookie;
|
|
3
3
|
export declare const isSourcePresent: () => boolean;
|
|
4
|
-
export declare const initSourceDetails: ({ platform, experiments, flow, affiliateChannel, offlineChannel,
|
|
4
|
+
export declare const initSourceDetails: ({ platform, experiments, flow, affiliateChannel, offlineChannel, pageProfile, performanceChannel, revenueChannel, salesProcess, guestId, landingPage, referrer, sourceChannel, }: SourceDetails) => Promise<void>;
|
|
5
5
|
export declare const setLastPage: (pagePath: string) => Promise<void>;
|
|
6
6
|
export declare const setFlowEntryPoint: (flowEntry: string) => Promise<void>;
|
|
7
7
|
export declare const setFlow: (flow: SignupFlow) => Promise<void>;
|
|
8
|
-
export declare const setOrganicChannel: (organicChannel: OrganicChannel) => Promise<void>;
|
|
9
8
|
export declare const setRevenueChannel: (revenueChannel: RevenueChannel) => Promise<void>;
|
|
10
9
|
export declare const setSalesProcess: (salesProcess: string) => Promise<void>;
|
|
11
10
|
export declare const clearSalesProcess: () => Promise<void>;
|
|
12
11
|
export declare const updateGuestId: (guestId: string) => Promise<void>;
|
|
13
12
|
export declare const setFirstPage: (pagePath: string) => Promise<void>;
|
|
14
13
|
export declare const setPlatformChannel: (platformChannel: Platform) => Promise<void>;
|
|
14
|
+
export declare const setLandingPage: (landingPage: string) => Promise<void>;
|
|
15
|
+
export declare const setReferrer: (referrer: string) => Promise<void>;
|
|
16
|
+
export declare const setSourceChannel: (sourceChannel: string) => Promise<void>;
|
|
17
|
+
export declare const setSubPlatform: (subPlatform: string) => Promise<void>;
|
|
18
|
+
export declare const setCurrentPage: (currentPage: string) => Promise<void>;
|
|
19
|
+
export declare const setPageProfile: (pageProfile: string) => Promise<void>;
|
|
20
|
+
export declare const setSignupForm: (signupForm: SignupForm) => Promise<void>;
|
|
21
|
+
export declare const clearSignupForm: () => Promise<void>;
|
|
22
|
+
export declare const getSourceChannel: (utmSource: string) => string;
|
|
@@ -7,15 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import { createCookie, getCookie, removeCookie } from '../cookie';
|
|
22
|
+
import utmSourceSourceChannelData from '../data/utm-source.json';
|
|
11
23
|
import { removeHrefLangFromPath } from '../url-parser';
|
|
12
24
|
const SOURCE_DETAILS_COOKIE = 'source_details';
|
|
13
|
-
const UTM_PARAMS = [
|
|
14
|
-
'utm_source',
|
|
15
|
-
'utm_medium',
|
|
16
|
-
'utm_campaign',
|
|
17
|
-
'utm_term',
|
|
18
|
-
];
|
|
19
25
|
export const readSourceCookie = () => {
|
|
20
26
|
const sourceDetails = getCookie(SOURCE_DETAILS_COOKIE);
|
|
21
27
|
return sourceDetails ? JSON.parse(decodeURIComponent(sourceDetails)) : undefined;
|
|
@@ -30,31 +36,17 @@ const updateSourceCookie = (sourceDetail) => {
|
|
|
30
36
|
if (!isSourcePresent())
|
|
31
37
|
return;
|
|
32
38
|
const sourceDetails = readSourceCookie();
|
|
33
|
-
const
|
|
39
|
+
const _a = sourceDetails || {}, { current = {} } = _a, restAttributes = __rest(_a, ["current"]);
|
|
40
|
+
const updatedDetails = Object.assign(Object.assign({}, sourceDetails), { current: !current
|
|
41
|
+
? Object.assign(Object.assign({}, restAttributes), sourceDetail) : Object.assign(Object.assign({}, current), sourceDetail) });
|
|
34
42
|
writeSourceCookie(updatedDetails);
|
|
35
43
|
};
|
|
36
|
-
const getRevenueChannel = (platform
|
|
44
|
+
const getRevenueChannel = (platform) => {
|
|
37
45
|
let revenueChannel = 'unknown';
|
|
38
46
|
// set defaults for WEBSITE and ASTRO
|
|
39
47
|
if (platform === 'website') {
|
|
40
48
|
revenueChannel = 'organic';
|
|
41
49
|
}
|
|
42
|
-
if (utmSource) {
|
|
43
|
-
switch (true) {
|
|
44
|
-
case /^affiliate-/.test(utmSource):
|
|
45
|
-
revenueChannel = 'affiliate';
|
|
46
|
-
break;
|
|
47
|
-
case /^offline-/.test(utmSource):
|
|
48
|
-
revenueChannel = 'offline';
|
|
49
|
-
break;
|
|
50
|
-
case /^referral-/.test(utmSource):
|
|
51
|
-
revenueChannel = 'referral';
|
|
52
|
-
break;
|
|
53
|
-
case /^performance-/.test(utmSource):
|
|
54
|
-
revenueChannel = 'performance';
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
50
|
return revenueChannel;
|
|
59
51
|
};
|
|
60
52
|
/*
|
|
@@ -73,107 +65,47 @@ const getFlow = (platform, experiments) => {
|
|
|
73
65
|
}
|
|
74
66
|
return flow;
|
|
75
67
|
};
|
|
76
|
-
const getUTMParams = () => {
|
|
77
|
-
if (typeof window === undefined)
|
|
78
|
-
return {};
|
|
79
|
-
const search = new URLSearchParams(window.location.search);
|
|
80
|
-
const utmParams = UTM_PARAMS.reduce((acc, param) => {
|
|
81
|
-
const utmParam = search.get(param);
|
|
82
|
-
if (utmParam) {
|
|
83
|
-
acc[param] = utmParam;
|
|
84
|
-
}
|
|
85
|
-
return acc;
|
|
86
|
-
}, {});
|
|
87
|
-
return utmParams;
|
|
88
|
-
};
|
|
89
68
|
const getFirstPage = () => {
|
|
90
69
|
if (typeof window === undefined)
|
|
91
70
|
return '';
|
|
92
71
|
return removeHrefLangFromPath(window.location.pathname);
|
|
93
72
|
};
|
|
94
|
-
/* TODO: Align Marketing Team on UTM source convention
|
|
95
|
-
affiliate-<channel>
|
|
96
|
-
performance-<channel>
|
|
97
|
-
organic-<channel>
|
|
98
|
-
offline-<channel>
|
|
99
|
-
*/
|
|
100
|
-
const getChannel = (utmSource) => {
|
|
101
|
-
// TODO: UTM source patter for FB, GOOGLE...
|
|
102
|
-
if (!utmSource)
|
|
103
|
-
return '';
|
|
104
|
-
let channel = '';
|
|
105
|
-
if (utmSource) {
|
|
106
|
-
switch (true) {
|
|
107
|
-
case /^affiliate-/.test(utmSource):
|
|
108
|
-
case /^offline-/.test(utmSource):
|
|
109
|
-
case /^referral-/.test(utmSource):
|
|
110
|
-
case /^performance-/.test(utmSource):
|
|
111
|
-
channel = utmSource.split('-')[1];
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return channel;
|
|
118
|
-
};
|
|
119
73
|
/*
|
|
120
74
|
Set Static Source Details of user on Visit of Platform
|
|
121
75
|
*/
|
|
122
76
|
export const initSourceDetails = ({ platform, experiments, // only for website.
|
|
123
|
-
flow, affiliateChannel, offlineChannel,
|
|
124
|
-
const utmParams = getUTMParams();
|
|
125
|
-
const { utm_source: utmSource } = utmParams;
|
|
126
|
-
const leadChannel = getChannel(utmSource);
|
|
77
|
+
flow, affiliateChannel, offlineChannel, pageProfile, performanceChannel, revenueChannel, salesProcess, guestId, landingPage, referrer, sourceChannel, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
78
|
/*
|
|
128
79
|
source cookie was added in cross subdomain for few days initially,
|
|
129
80
|
which was later changed to subdomain specific. Now to sending older cookie to backend, removing older cookie
|
|
130
81
|
*/
|
|
131
82
|
removeCookie(SOURCE_DETAILS_COOKIE, true);
|
|
132
|
-
revenueChannel = revenueChannel || getRevenueChannel(platform
|
|
133
|
-
if (utmSource) {
|
|
134
|
-
switch (revenueChannel) {
|
|
135
|
-
case 'affiliate':
|
|
136
|
-
affiliateChannel = affiliateChannel || leadChannel;
|
|
137
|
-
break;
|
|
138
|
-
case 'offline':
|
|
139
|
-
offlineChannel = offlineChannel || leadChannel;
|
|
140
|
-
break;
|
|
141
|
-
case 'organic':
|
|
142
|
-
organicChannel = organicChannel || leadChannel;
|
|
143
|
-
break;
|
|
144
|
-
case 'performance':
|
|
145
|
-
performanceChannel = performanceChannel || leadChannel;
|
|
146
|
-
break;
|
|
147
|
-
default:
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
83
|
+
revenueChannel = revenueChannel || getRevenueChannel(platform);
|
|
151
84
|
if (!isSourcePresent()) {
|
|
152
85
|
const sourceDetails = {
|
|
153
86
|
platform_channel: platform,
|
|
154
87
|
experiment_dict: experiments,
|
|
155
|
-
utm_params: utmParams,
|
|
156
88
|
flow: flow || getFlow(platform, experiments),
|
|
157
89
|
affiliate_channel: affiliateChannel,
|
|
158
90
|
offline_channel: offlineChannel,
|
|
159
|
-
|
|
91
|
+
page_profile: pageProfile,
|
|
160
92
|
performance_channel: performanceChannel,
|
|
161
93
|
revenue_channel: revenueChannel,
|
|
162
94
|
first_page: getFirstPage(),
|
|
163
95
|
sales_process: salesProcess,
|
|
164
96
|
guest_id: guestId,
|
|
97
|
+
landing_page: landingPage,
|
|
98
|
+
referrer,
|
|
99
|
+
source_channel: sourceChannel,
|
|
165
100
|
};
|
|
166
101
|
writeSourceCookie(sourceDetails);
|
|
167
102
|
}
|
|
168
103
|
else {
|
|
169
|
-
|
|
104
|
+
const updatedSource = {
|
|
170
105
|
experiment_dict: experiments,
|
|
171
106
|
flow: flow || getFlow(platform, experiments),
|
|
172
107
|
guest_id: guestId,
|
|
173
108
|
};
|
|
174
|
-
if (utmSource) {
|
|
175
|
-
updatedSource = Object.assign(Object.assign({}, updatedSource), { utm_params: utmParams, affiliate_channel: affiliateChannel, offline_channel: offlineChannel, organic_channel: organicChannel, performance_channel: performanceChannel, revenue_channel: revenueChannel });
|
|
176
|
-
}
|
|
177
109
|
updateSourceCookie(updatedSource);
|
|
178
110
|
}
|
|
179
111
|
});
|
|
@@ -189,9 +121,6 @@ export const setFlowEntryPoint = (flowEntry) => __awaiter(void 0, void 0, void 0
|
|
|
189
121
|
export const setFlow = (flow) => __awaiter(void 0, void 0, void 0, function* () {
|
|
190
122
|
updateSourceCookie({ flow });
|
|
191
123
|
});
|
|
192
|
-
export const setOrganicChannel = (organicChannel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
193
|
-
updateSourceCookie({ organic_channel: organicChannel });
|
|
194
|
-
});
|
|
195
124
|
export const setRevenueChannel = (revenueChannel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
196
125
|
updateSourceCookie({ revenue_channel: revenueChannel });
|
|
197
126
|
});
|
|
@@ -210,4 +139,35 @@ export const setFirstPage = (pagePath) => __awaiter(void 0, void 0, void 0, func
|
|
|
210
139
|
export const setPlatformChannel = (platformChannel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
211
140
|
updateSourceCookie({ platform_channel: platformChannel });
|
|
212
141
|
});
|
|
142
|
+
export const setLandingPage = (landingPage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
143
|
+
updateSourceCookie({ landing_page: landingPage });
|
|
144
|
+
});
|
|
145
|
+
export const setReferrer = (referrer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
146
|
+
updateSourceCookie({ referrer });
|
|
147
|
+
});
|
|
148
|
+
export const setSourceChannel = (sourceChannel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
+
updateSourceCookie({ source_channel: sourceChannel });
|
|
150
|
+
});
|
|
151
|
+
export const setSubPlatform = (subPlatform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
+
updateSourceCookie({ sub_platform: subPlatform });
|
|
153
|
+
});
|
|
154
|
+
export const setCurrentPage = (currentPage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
+
updateSourceCookie({ current_page: currentPage });
|
|
156
|
+
});
|
|
157
|
+
export const setPageProfile = (pageProfile) => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
|
+
updateSourceCookie({ page_profile: pageProfile });
|
|
159
|
+
});
|
|
160
|
+
export const setSignupForm = (signupForm) => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
+
updateSourceCookie({ signup_form: signupForm });
|
|
162
|
+
});
|
|
163
|
+
export const clearSignupForm = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
+
updateSourceCookie({ signup_form: {} });
|
|
165
|
+
});
|
|
166
|
+
export const getSourceChannel = (utmSource) => {
|
|
167
|
+
const utmSourceMap = Object.assign({}, utmSourceSourceChannelData);
|
|
168
|
+
if (utmSourceMap[utmSource]) {
|
|
169
|
+
return utmSourceMap[utmSource];
|
|
170
|
+
}
|
|
171
|
+
return 'Others';
|
|
172
|
+
};
|
|
213
173
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/growth-source/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/growth-source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,0BAA0B,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAwB,EAAE;IACxD,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAEvD,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAA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M,cAAc,GAAG,CAAO,WAAmB,EAAiB,EAAE;IACzE,kBAAkB,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAO,UAAsB,EAAiB,EAAE;IAC3E,kBAAkB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAClD,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAwB,EAAE;IACvD,kBAAkB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC5D,MAAM,YAAY,qBAGb,0BAA0B,CAC9B,CAAC;IAEF,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE;QAC3B,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;KAChC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const csv = require('papaparse');
|
|
6
|
+
const ClusterMetaInfoFileName = 'utm-source';
|
|
7
|
+
(function csvFileToJSON() {
|
|
8
|
+
const INPUT_FILE_PATH = path.resolve(__dirname, '.', `../../data/${ClusterMetaInfoFileName}.csv`);
|
|
9
|
+
const OUTPUT_FILE_PATH = path.resolve(__dirname, '.', `../../data/${ClusterMetaInfoFileName}.json`);
|
|
10
|
+
try {
|
|
11
|
+
fs.readFile(INPUT_FILE_PATH, 'utf-8', (err, data) => {
|
|
12
|
+
if (err)
|
|
13
|
+
throw err;
|
|
14
|
+
const options = {
|
|
15
|
+
header: true,
|
|
16
|
+
delimiter: ',',
|
|
17
|
+
quoteChar: '"',
|
|
18
|
+
escapeChar: '\\',
|
|
19
|
+
};
|
|
20
|
+
const jsonObj = csv.parse(data, options).data;
|
|
21
|
+
let sourceChannelData = {};
|
|
22
|
+
jsonObj.forEach(utmSourceChannelObject => {
|
|
23
|
+
const { utm_source: utmSource, source_channel: sourceChannel } = utmSourceChannelObject || {};
|
|
24
|
+
if (sourceChannelData[utmSource]) {
|
|
25
|
+
throw new Error(`Duplicate utm_source Found ${utmSource}`);
|
|
26
|
+
}
|
|
27
|
+
sourceChannelData[utmSource] = sourceChannel;
|
|
28
|
+
});
|
|
29
|
+
const jsonString = JSON.stringify(sourceChannelData, null, 2);
|
|
30
|
+
fs.writeFile(OUTPUT_FILE_PATH, jsonString, e => {
|
|
31
|
+
if (e)
|
|
32
|
+
throw e;
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log('CSV file converted to JSON');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.log(err);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
//# sourceMappingURL=source-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-channel.js","sourceRoot":"","sources":["../../../../src/growth-source/scripts/source-channel.js"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEjC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C,CAAC,SAAS,aAAa;IACrB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAClC,SAAS,EACT,GAAG,EACH,cAAc,uBAAuB,MAAM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;QACZ,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -9,8 +9,15 @@ export type UTMParams = {
|
|
|
9
9
|
utm_medium?: string;
|
|
10
10
|
utm_campaign?: string;
|
|
11
11
|
utm_term?: string;
|
|
12
|
+
utm_content?: string;
|
|
13
|
+
utm_adcontent?: string;
|
|
12
14
|
};
|
|
13
15
|
export type UTMParamsKeys = keyof UTMParams;
|
|
16
|
+
export type SignupForm = {
|
|
17
|
+
form_id?: string;
|
|
18
|
+
product?: string;
|
|
19
|
+
process?: string;
|
|
20
|
+
};
|
|
14
21
|
export type SourceDetailsCookie = {
|
|
15
22
|
platform_channel: Platform;
|
|
16
23
|
experiment_dict?: Experiments;
|
|
@@ -20,12 +27,19 @@ export type SourceDetailsCookie = {
|
|
|
20
27
|
offline_channel?: string;
|
|
21
28
|
performance_channel?: string;
|
|
22
29
|
revenue_channel: RevenueChannel;
|
|
23
|
-
organic_channel?: string;
|
|
24
30
|
flow_entry?: string;
|
|
25
31
|
first_page?: string;
|
|
26
32
|
last_page?: string;
|
|
27
33
|
sales_process?: string;
|
|
28
34
|
guest_id?: string;
|
|
35
|
+
current?: Partial<SourceDetailsCookie>;
|
|
36
|
+
landing_page?: string;
|
|
37
|
+
referrer?: string;
|
|
38
|
+
source_channel?: string;
|
|
39
|
+
page_profile?: string;
|
|
40
|
+
sub_platform?: string;
|
|
41
|
+
current_page?: string;
|
|
42
|
+
signup_form?: SignupForm;
|
|
29
43
|
};
|
|
30
44
|
export type SourceDetails = {
|
|
31
45
|
platform: Platform;
|
|
@@ -36,10 +50,14 @@ export type SourceDetails = {
|
|
|
36
50
|
offlineChannel?: string;
|
|
37
51
|
performanceChannel?: string;
|
|
38
52
|
revenueChannel: RevenueChannel;
|
|
39
|
-
organicChannel?: string;
|
|
40
53
|
flowEntry?: string;
|
|
41
54
|
firstPage?: string;
|
|
42
55
|
lastPage?: string;
|
|
43
56
|
guestId?: string;
|
|
44
57
|
salesProcess?: string;
|
|
58
|
+
landingPage?: string;
|
|
59
|
+
referrer?: string;
|
|
60
|
+
sourceChannel?: string;
|
|
61
|
+
pageProfile?: string;
|
|
62
|
+
subPlatform?: string;
|
|
45
63
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getTopicName: (path: string) => any;
|
|
2
|
-
export declare function getSubRevenueChannel(pathname?: string): "Brand" | "Intent" | "Supply" | "Referral" | "Content"
|
|
2
|
+
export declare function getSubRevenueChannel(pathname?: string): "Others" | "Brand" | "Intent" | "Supply" | "Referral" | "Content";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuemath/web-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"description": "Shared web utils package",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -74,7 +74,10 @@
|
|
|
74
74
|
"husky": "8.0.2",
|
|
75
75
|
"lint-staged": ">=10",
|
|
76
76
|
"prettier": "^2.8.1",
|
|
77
|
-
"typescript": "4.9.4"
|
|
77
|
+
"typescript": "4.9.4",
|
|
78
|
+
"fs": "^0.0.1-security",
|
|
79
|
+
"papaparse": "^5.4.1",
|
|
80
|
+
"path": "^0.12.7"
|
|
78
81
|
},
|
|
79
82
|
"dependencies": {
|
|
80
83
|
"@types/node": "^18.11.18",
|