From 0f3040fc9a0029a73cc86da1bd333771038bab14 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Mon, 20 Jan 2025 12:32:36 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liorations=20posthog=20-=20meilleure=20?= =?UTF-8?q?gestion=20du=20mode=20iframe=20-=20correctif=20sur=20le=20scrip?= =?UTF-8?q?t=20qui=20ne=20redirige=20pas=20sur=20la=20bonne=20route?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/to_compile/entrypoints/assistant/script-to-iframe.ts | 3 ++- static/to_compile/js/controllers/assistant/analytics.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/to_compile/entrypoints/assistant/script-to-iframe.ts b/static/to_compile/entrypoints/assistant/script-to-iframe.ts index 96cde9357..5ea167d2c 100644 --- a/static/to_compile/entrypoints/assistant/script-to-iframe.ts +++ b/static/to_compile/entrypoints/assistant/script-to-iframe.ts @@ -3,7 +3,8 @@ import { iframeResize } from "iframe-resizer"; const script = document.currentScript as HTMLScriptElement const slug = script?.dataset?.objet; const origin = new URL(script?.getAttribute("src")).origin -const src = `${origin}/${slug || ''}?iframe`; +// TODO: mise en prod, remplacer dechet ci-dessous par une string vide +const src = `${origin}/${slug || 'dechet'}?iframe`; const iframe = document.createElement("iframe"); const iframeAttributes = { diff --git a/static/to_compile/js/controllers/assistant/analytics.ts b/static/to_compile/js/controllers/assistant/analytics.ts index fbebde9a5..473385973 100644 --- a/static/to_compile/js/controllers/assistant/analytics.ts +++ b/static/to_compile/js/controllers/assistant/analytics.ts @@ -91,7 +91,7 @@ export default class extends Controller { this.personProperties.iframe = true } - if (document.referrer) { + if (document.referrer && !document.referrer.includes(document.location.origin)) { this.personProperties.iframe = true } }