-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature : ajout du mode cookieless si l'utilisateur n'accepte pas les…
… cookies posthog + envoi de l'opportunityId quand on envoi un formulaire (#1303) - modification de l'api opportunity pour renvoyer l'opportunityId dans la réponse - initialisation de posthog avec persistence: 'memory' (mode cookieless) - si acceptation des cookies > persistence: 'localStorage+cookie' - si refus des cookies > persistence: 'memory' - plus de vérification de l'acceptation des cookies pour l'envoi des formulaires - ajout de l'opportunityId dans les properties de la capture de l'event Pour tester en local bien modifier l'initialisation de posthog (qui normalement n'est possible qu'en prod)
- Loading branch information
1 parent
833c21b
commit 25db8ec
Showing
5 changed files
with
16 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import Posthog from '@/utils/analytic/posthog' | ||
import Cookie from '@/utils/cookies' | ||
import { CookieValue } from '@/types/cookies' | ||
import Matomo from './matomo' | ||
|
||
export default class Analytics { | ||
static sendEvent(action: string, name: string | null = null, value?: string | number | object | Record<string, string | number>) { | ||
const posthogCookie = Cookie.getCookieByValue(CookieValue.Posthog) | ||
if (posthogCookie?.accepted) { | ||
Posthog.captureEvent(action, name ? name : 'unnamed event', value) | ||
} | ||
|
||
static sendEvent(action: string, name: string | null = null, value?: object) { | ||
Posthog.captureEvent(name ? name : 'unnamed event', value) | ||
Matomo.sendEvent(action, name, JSON.stringify(value)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters