* feat: google ads conversion tracking * gaClientid * store gclid in stripe metadata * tracking only in the us * track google campaign id as well * rename gclid -> google ads * fix: build * fix * refactor * fix: type check * fix: type check * fix: type check * fix: type check * fix: store it in cookie * refactor * fix * cleanup * linked ads tracking * refactor checkout session tracking
17 lines
422 B
TypeScript
17 lines
422 B
TypeScript
export const getCookie = (name: string) => {
|
|
if (typeof document === "undefined") {
|
|
return null;
|
|
}
|
|
return document.cookie
|
|
.split(";")
|
|
.find((cookie) => cookie.trim().startsWith(`${name}=`))
|
|
?.split("=")[1];
|
|
};
|
|
|
|
export const setCookie = (name: string, value: string, options: string) => {
|
|
if (typeof document === "undefined") {
|
|
return;
|
|
}
|
|
document.cookie = `${name}=${value}; ${options}`;
|
|
};
|