-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtracking.ts
More file actions
24 lines (19 loc) · 845 Bytes
/
tracking.ts
File metadata and controls
24 lines (19 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import type {
BannerTest,
BannerVariant,
EpicTest,
EpicVariant,
GutterTest,
GutterVariant,
} from '../../shared/types';
const campaignPrefix = 'gdnwb_copts_memco';
export const buildEpicCampaignCode = (test: EpicTest, variant: EpicVariant): string =>
`${campaignPrefix}_${test.campaignId || test.name}_${variant.name}`;
export const buildBannerCampaignCode = (test: BannerTest, variant: BannerVariant): string =>
`${test.name}_${variant.name}`;
export const buildGutterCampaignCode = (testName: GutterTest, variantName: GutterVariant): string =>
`gutter__${testName.name}__${variantName.name}`;
export const addQueryParams = (baseUrl: string, queryParams: string) => {
const alreadyHasQueryString = baseUrl.includes('?');
return `${baseUrl}${alreadyHasQueryString ? '&' : '?'}${queryParams}`;
};