Fix: Referral-Code überlebt App-Schließen (localStorage statt sessionStorage)
Werben-Zuordnung ging verloren, wenn die geworbene Person den ?ref=-Link öffnete, die App schloss und sich erst später registrierte (sessionStorage flüchtig, v.a. iOS-PWA). Jetzt: Code früh in boot.js nach localStorage (vor evtl. SW-Reload, der die URL ersetzt), 30-Tage-Ablauf, Löschung nach Registrierung. SW v1169 Datenkorrektur separat: nacho_sarah Angie (id=4) als 2. Werbung zugeordnet.
This commit is contained in:
parent
7945087a6c
commit
3513aeadb0
7 changed files with 56 additions and 22 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1168'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1169'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
||||
window.APP_VERSION = APP_VERSION;
|
||||
|
|
@ -1116,11 +1116,15 @@ const App = (() => {
|
|||
sessionStorage.setItem('by_stay_in_app', '1');
|
||||
}
|
||||
|
||||
// Referral-Code aus URL ?ref=CODE speichern
|
||||
// Referral-Code aus URL ?ref=CODE speichern (Backup zu boot.js; localStorage
|
||||
// überlebt App-Schließen, sodass die Zuordnung auch bei späterer Registrierung klappt)
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const refCode = urlParams.get('ref');
|
||||
if (refCode) {
|
||||
sessionStorage.setItem('by_ref_code', refCode.toUpperCase());
|
||||
try {
|
||||
localStorage.setItem('by_ref_code', refCode.toUpperCase());
|
||||
localStorage.setItem('by_ref_code_ts', String(Date.now()));
|
||||
} catch {}
|
||||
// URL bereinigen ohne Reload
|
||||
history.replaceState({}, '', window.location.pathname + window.location.hash);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue