Skip to content

chore: potential mistagging log #2895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/scripts/packages/marketing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deriv-com/marketing-utils",
"version": "1.0.15",
"version": "1.0.16",
"type": "module",
"repository": {
"type": "git",
Expand Down
20 changes: 20 additions & 0 deletions public/scripts/packages/marketing/src/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ function DerivMarketingCookies() {
}
});

let potential_mistagging = true;
let overwrite_happened = false;
let dropped_affiliate_tracking = null;

if (shouldOverwrite(utm_data, current_utm_data)) {
eraseCookie("affiliate_tracking");
eraseCookie("utm_data");
Expand All @@ -239,6 +243,9 @@ function DerivMarketingCookies() {
.replaceAll("%7D", "}");

setCookie("utm_data", utm_data_cookie);
overwrite_happened = true;
} else {
potential_mistagging = false;
}

/* end handling UTMs */
Expand All @@ -247,6 +254,11 @@ function DerivMarketingCookies() {
const isAffiliateTokenExist =
searchParams.has("t") || searchParams.has("affiliate_token");
if (isAffiliateTokenExist) {
if (overwrite_happened) {
dropped_affiliate_tracking = getCookie("affiliate_token");
potential_mistagging = false;
}

eraseCookie("affiliate_tracking");
const affiliateToken =
searchParams.get("t") || searchParams.get("affiliate_token");
Expand All @@ -257,6 +269,11 @@ function DerivMarketingCookies() {
eraseCookie("affiliate_tracking");
const sidcValue = searchParams.get("sidc");
setCookie("affiliate_tracking", sidcValue);

if (overwrite_happened) {
dropped_affiliate_tracking = getCookie("affiliate_token");
potential_mistagging = false;
}
}
/* end handling affiliate tracking */

Expand Down Expand Up @@ -429,6 +446,9 @@ function DerivMarketingCookies() {
trackEvent("debug_marketing_cookies", {
marketing_cookies: getStringifiedCookies(),
cookie_status: testCookieFunctionality(),
potential_mistagging,
overwrite_happened,
dropped_affiliate_tracking,
});
}, 1000);
} else if (retries > 0) {
Expand Down