Skip to content

Commit

Permalink
Améliorations posthog
Browse files Browse the repository at this point in the history
- meilleure gestion du mode iframe
- correctif sur le script qui ne redirige pas sur la bonne route
  • Loading branch information
fabienheureux committed Jan 20, 2025
1 parent a257df5 commit 0f3040f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion static/to_compile/entrypoints/assistant/script-to-iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion static/to_compile/js/controllers/assistant/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class extends Controller<HTMLElement> {
this.personProperties.iframe = true
}

if (document.referrer) {
if (document.referrer && !document.referrer.includes(document.location.origin)) {
this.personProperties.iframe = true
}
}
Expand Down

0 comments on commit 0f3040f

Please sign in to comment.