Skip to content

Add worker which allows a user's landing UTM to be carried forward in a cookie through their site journey#3

Open
alxbridge wants to merge 1 commit intomasterfrom
add-utm-cookie-caching-worker
Open

Add worker which allows a user's landing UTM to be carried forward in a cookie through their site journey#3
alxbridge wants to merge 1 commit intomasterfrom
add-utm-cookie-caching-worker

Conversation

@alxbridge
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Member

@tomusher tomusher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

if (!hasUtmCookie(request)) {
const url = new URL(request.url);
if (STRIP_QUERYSTRING_KEYS.some((key) => url.searchParams.get(key))) {
return url.search;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you return only the utm searchParams instead of the whole url.search? I have no idea how this cookie will be used so it might not matter too much.

let request = event.request;

// get value for setting a new UTM cookie
newUtmCookieValue = getUtmCookieValue(request);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
newUtmCookieValue = getUtmCookieValue(request);
const newUtmCookieValue = getUtmCookieValue(request);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants