save affiliate_visitor cookie when there is affiliate param when accessing pages

This commit is contained in:
Nuwan 2025-03-04 23:40:08 +05:30
parent 9d7fea284a
commit 89411738cb
5 changed files with 15 additions and 3 deletions

View File

@ -10,3 +10,4 @@ REACT_APP_ENV=development
REACT_APP_RECAPTCHA_ENABLED=false
REACT_APP_SITE_KEY=6Let8dgSAAAAAFheKGWrs6iaq_hIlPOZ2f3Bb56B
PUBLIC_URL=
REACT_APP_COOKIE_DOMAIN=.jamkazam.local

View File

@ -6,4 +6,5 @@ REACT_APP_CLIENT_BASE_URL=http://www.jamkazam.local:3000
REACT_APP_API_BASE_URL=http://www.jamkazam.local:3000/api
REACT_APP_BITBUCKET_BUILD_NUMBER=dev
REACT_APP_BITBUCKET_COMMIT=dev
REACT_APP_ENV=development
REACT_APP_ENV=development
REACT_APP_COOKIE_DOMAIN=.jamkazam.com

View File

@ -1,9 +1,10 @@
HOST=beta.jamkazam.com
PORT=4000
REACT_APP_ORIGIN=jamkazam.com
REACT_APP_BASE_URL=https://www.jamkazam.com
REACT_APP_BASE_URL=https://beta.jamkazam.com
REACT_APP_CLIENT_BASE_URL=https://www.jamkazam.com
REACT_APP_API_BASE_URL=https://www.jamkazam.com/api
REACT_APP_ENV=production
REACT_APP_RECAPTCHA_ENABLED=true
REACT_APP_SITE_KEY=6Let8dgSAAAAAFheKGWrs6iaq_hIlPOZ2f3Bb56B
REACT_APP_COOKIE_DOMAIN=.jamkazam.com

View File

@ -1,9 +1,10 @@
HOST=beta.staging.jamkazam.com
PORT=4000
REACT_APP_ORIGIN=staging.jamkazam.com
REACT_APP_BASE_URL=https://staging.jamkazam.com
REACT_APP_BASE_URL=https://beta.staging.jamkazam.com
REACT_APP_CLIENT_BASE_URL=https://staging.jamkazam.com
REACT_APP_API_BASE_URL=https://staging.jamkazam.com/api
REACT_APP_ENV=staging
REACT_APP_RECAPTCHA_ENABLED=false
REACT_APP_SITE_KEY=6Let8dgSAAAAAFheKGWrs6iaq_hIlPOZ2f3Bb56B
REACT_APP_COOKIE_DOMAIN=.staging.jamkazam.com

View File

@ -15,6 +15,14 @@ const Layout = () => {
useEffect(() => {
AuthBasicLayout.preload();
PublicLayout.preload();
//see if there is affiliate in query string and save it as cookie
const urlParams = new URLSearchParams(window.location.search);
const affiliate = urlParams.get('affiliate');
const maxAge = 2592000; // 30 days
if (affiliate) {
document.cookie = `affiliate_visitor=${affiliate}; path=/; max-age=${maxAge}; domain=${process.env.REACT_APP_COOKIE_DOMAIN}`;
}
}, []);
return (