Skip to content

Commit 5616f72

Browse files
committed
types
1 parent fe3169b commit 5616f72

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
interface UtmParams {
2+
utm_source?: string;
3+
utm_medium?: string;
4+
utm_campaign?: string;
5+
}
6+
/**
7+
* Sanitizes a string to remove all characters except A-Z, a-z, 0-9, hyphen (-), underscore (_)
8+
* @param input - The string to sanitize
9+
* @returns Sanitized string
10+
*/
11+
export declare function sanitize(input: string): string;
12+
/**
13+
* Initializes UTM cookie handling on page load
14+
* Extracts UTM parameters from URL, sanitizes them, and persists to cookie
15+
* Only sets the cookie if it doesn't already exist
16+
*/
17+
export declare function initializeUtmCookieHandler(): void;
18+
/**
19+
* Retrieves and parses the tc_utm cookie
20+
* @returns Parsed UTM parameters or null if cookie doesn't exist
21+
*/
22+
export declare function getUtmCookie(): UtmParams | null;
23+
/**
24+
* Appends UTM parameters from the tc_utm cookie to a given URL
25+
* Only appends parameters that exist in the cookie
26+
* @param url - The base URL to append parameters to
27+
* @returns URL with UTM parameters appended, or original URL if no cookie exists
28+
*/
29+
export declare function appendUtmParamsToUrl(url: string): string;
30+
export {};

0 commit comments

Comments
 (0)