From eeadb718552681a8cfe4970dbebaf2b8aa85fa83 Mon Sep 17 00:00:00 2001 From: Ouijdane IMER Date: Thu, 9 Oct 2025 11:06:59 +0200 Subject: [PATCH] Commit_Formulaires --- .gitignore | 1 + .../ENSITECH/CandidatureEnsitech | 1871 ++++++++++++++++ .../ENSITECH/DatalayerEnsitech.txt | 168 ++ .../ENSITECH/Demande_DeContact_Ensitech | 896 ++++++++ FormulaireEnsitech_Ensup/ENSITECH/JPOEnsitech | 1053 +++++++++ .../ENSITECH/brochureEnsitech | 883 ++++++++ .../ENSUP/BrochureEnsup.html | 952 ++++++++ .../ENSUP/CandidatureEnsup.html | 1943 +++++++++++++++++ FormulaireEnsitech_Ensup/ENSUP/DatalayerEnsup | 169 ++ .../ENSUP/formulaireContactEnsup.html | 861 ++++++++ FormulaireEnsitech_Ensup/ENSUP/jpoEnsup.html | 1119 ++++++++++ 11 files changed, 9916 insertions(+) create mode 100644 .gitignore create mode 100644 FormulaireEnsitech_Ensup/ENSITECH/CandidatureEnsitech create mode 100644 FormulaireEnsitech_Ensup/ENSITECH/DatalayerEnsitech.txt create mode 100644 FormulaireEnsitech_Ensup/ENSITECH/Demande_DeContact_Ensitech create mode 100644 FormulaireEnsitech_Ensup/ENSITECH/JPOEnsitech create mode 100644 FormulaireEnsitech_Ensup/ENSITECH/brochureEnsitech create mode 100644 FormulaireEnsitech_Ensup/ENSUP/BrochureEnsup.html create mode 100644 FormulaireEnsitech_Ensup/ENSUP/CandidatureEnsup.html create mode 100644 FormulaireEnsitech_Ensup/ENSUP/DatalayerEnsup create mode 100644 FormulaireEnsitech_Ensup/ENSUP/formulaireContactEnsup.html create mode 100644 FormulaireEnsitech_Ensup/ENSUP/jpoEnsup.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b1e5f42 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vs/ diff --git a/FormulaireEnsitech_Ensup/ENSITECH/CandidatureEnsitech b/FormulaireEnsitech_Ensup/ENSITECH/CandidatureEnsitech new file mode 100644 index 0000000..9a98547 --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSITECH/CandidatureEnsitech @@ -0,0 +1,1871 @@ + + + + + + + + + + + + + + +
+
+
+ +
+ +
+

Faisons les présentations !

+

Je renseigne quelques informations pour commencer.

+ +
+
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+ +
+
+ +
+

Projet de formation

+

Je choisis la formation qui m'intéresse et le campus souhaité.

+ +
+
+ +
+
+ +
+
+ +
+
+ + + + +
+
+ +
+ + +
+ +
(*) Champs obligatoires
+ + + + + + + + + +
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSITECH/DatalayerEnsitech.txt b/FormulaireEnsitech_Ensup/ENSITECH/DatalayerEnsitech.txt new file mode 100644 index 0000000..795124d --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSITECH/DatalayerEnsitech.txt @@ -0,0 +1,168 @@ +(function() { + 'use strict'; + + console.log('🔧 DataLayer universel chargé'); + + // Arrêter sur les pages de confirmation + if (window.location.href.includes('confirmation')) { + console.log('⏭️ Page de confirmation - script ignoré'); + return; + } + + // Attendre le formulaire avec plus de patience + function waitForForm(maxAttempts = 100) { + let attempts = 0; + + const checkInterval = setInterval(function() { + attempts++; + const form = document.getElementById('oscar_school_form'); + + if (form) { + clearInterval(checkInterval); + console.log('✅ Formulaire trouvé après', attempts, 'tentatives'); + initializeDataLayer(form); + } else if (attempts >= maxAttempts) { + clearInterval(checkInterval); + console.log('⏱️ Formulaire non trouvé après ' + (maxAttempts * 200 / 1000) + ' secondes'); + } + }, 200); + } + + function initializeDataLayer(form) { + console.log('📊 Initialisation tracking DataLayer'); + + // Fonction SHA-256 + async function sha256(value) { + if (!value) return ''; + try { + const encoder = new TextEncoder(); + const data = encoder.encode(value.trim().toLowerCase()); + const hashBuffer = await crypto.subtle.digest('SHA-256', data); + const hashArray = Array.from(new Uint8Array(hashBuffer)); + return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); + } catch (error) { + console.error('❌ Erreur hashage:', error); + return ''; + } + } + + // Récupérer texte d'un select + function getSelectText(selectId) { + const select = document.getElementById(selectId); + if (select && select.selectedIndex >= 0 && select.options[select.selectedIndex]) { + return select.options[select.selectedIndex].text; + } + return ''; + } + + // Fonction principale de capture + async function captureAndPushDataLayer() { + console.log('📝 Capture des données formulaire'); + + // Vérifier consentement CNIL + const consentCheckbox = document.querySelector('input[name="cnil"]'); + if (!consentCheckbox || !consentCheckbox.checked) { + console.warn('⚠️ Pas de consentement CNIL - dataLayer non envoyé'); + return; + } + + // Récupération des champs (compatible tous formulaires) + const typeRaw = (document.querySelector('input[name="type_formulaire"]') || {}).value || ''; + const emailRaw = (document.getElementById('email') || {}).value || ''; + const portableRaw = (document.getElementById('portable') || {}).value || ''; + const villeRaw = (document.getElementById('ville') || {}).value || ''; + const codePostalRaw = (document.getElementById('codepostal') || document.getElementById('code_postal') || {}).value || ''; + const campusRaw = (document.getElementById('campus_selection') || {}).value || ''; + + // Selects (texte, pas value) + const statusRaw = getSelectText('OscarContactJeSuisRefIdField'); + const formationRaw = getSelectText('formation'); + + // Pays + const paysSelect = document.getElementById('pays'); + let paysNom = ''; + if (paysSelect && paysSelect.selectedIndex > 0) { + paysNom = paysSelect.options[paysSelect.selectedIndex].text; + } + + console.log('📦 Données:', { + type: typeRaw, + status: statusRaw, + campus: campusRaw, + formation: formationRaw, + hasEmail: !!emailRaw, + hasPhone: !!portableRaw + }); + + // Hashage + const emailHash = await sha256(emailRaw); + const portableHash = await sha256(portableRaw); + const codePostalHash = await sha256(codePostalRaw); + + // Construction dataLayer + const dataLayerObject = { + event: 'form_submit', + type: typeRaw.trim().toLowerCase(), + je_suis: statusRaw.trim(), + sha256_email_address: emailHash, + sha256_phone_number: portableHash, + sha256_postal_code: codePostalHash, + ville: villeRaw.trim(), + pays: paysNom, + campus: campusRaw.trim(), + formation: formationRaw.trim() + }; + + // Push dataLayer + window.dataLayer = window.dataLayer || []; + window.dataLayer.push(dataLayerObject); + + console.log('🚀 DataLayer push réussi:', dataLayerObject); + } + + // Attacher aux événements submit du FORMULAIRE + form.addEventListener('submit', async function(event) { + console.log('📝 Event: form submit'); + await captureAndPushDataLayer(); + }); + + // Attacher AUSSI aux boutons (pour formulaire contact) + const desktopBtn = document.getElementById('desktop-submit-btn'); + const mobileBtn = document.getElementById('mobile-submit-btn'); + + if (desktopBtn) { + desktopBtn.addEventListener('click', async function(e) { + console.log('📝 Event: desktop button click'); + await captureAndPushDataLayer(); + }); + } + + if (mobileBtn) { + mobileBtn.addEventListener('click', async function(e) { + console.log('📝 Event: mobile button click'); + await captureAndPushDataLayer(); + }); + } + + // Boutons submit classiques (JPO, candidature) + const submitButtons = form.querySelectorAll('button[type="submit"]'); + submitButtons.forEach(btn => { + btn.addEventListener('click', async function(e) { + console.log('📝 Event: submit button click'); + // Ne pas empêcher l'événement, juste capturer + await captureAndPushDataLayer(); + }); + }); + + console.log('✅ Tracking activé sur tous les événements'); + } + + // Démarrage + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', function() { + waitForForm(); + }); + } else { + waitForForm(); + } +})(); diff --git a/FormulaireEnsitech_Ensup/ENSITECH/Demande_DeContact_Ensitech b/FormulaireEnsitech_Ensup/ENSITECH/Demande_DeContact_Ensitech new file mode 100644 index 0000000..323687e --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSITECH/Demande_DeContact_Ensitech @@ -0,0 +1,896 @@ + + + + + + Formulaire de contact Oscar School + + + + + + + +
+
+
+ +
+ +
+
+

Une question sur nos formations, l'admission, le campus ou l'alternance ?

+

Veuillez compléter ce formulaire, notre équipe vous recontactera rapidement.

+
+ +
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + + + +
+
+ +
+ +
+ +
(*) Champs obligatoires
+ + + + + + + + + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSITECH/JPOEnsitech b/FormulaireEnsitech_Ensup/ENSITECH/JPOEnsitech new file mode 100644 index 0000000..eba2aad --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSITECH/JPOEnsitech @@ -0,0 +1,1053 @@ + + + + +
+
+
+ +
+
+

Inscription JPO

+

Complétez ce formulaire pour vous inscrire.

+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + + +
+ +
+
+ + +
+
+ + +
+ + +
+
+ + +
+
+ + + + + + + +
+
+ + +
+ +
+ + +
(*) Champs obligatoires
+ + + + + + + + + + + + +
+
+
+ + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSITECH/brochureEnsitech b/FormulaireEnsitech_Ensup/ENSITECH/brochureEnsitech new file mode 100644 index 0000000..026bbe5 --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSITECH/brochureEnsitech @@ -0,0 +1,883 @@ + + + + + + + + + + + + + +
+
+
+ +
+ +
+

Demande de brochure

+

Remplissez ce formulaire pour accéder à notre brochure.

+ +
+
+ + + + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + + + +
+
+ +
+ +
+ +
(*) Champs obligatoires
+ + + + + + + + + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSUP/BrochureEnsup.html b/FormulaireEnsitech_Ensup/ENSUP/BrochureEnsup.html new file mode 100644 index 0000000..d39cf88 --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSUP/BrochureEnsup.html @@ -0,0 +1,952 @@ + + + + + + Formulaire de Brochure Oscar School + + + + + + + + +
+
+
+ +
+ +
+

Demande de brochure

+

Remplissez ce formulaire pour accéder à notre brochure.

+ +
+
+ + + + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + + + +
+
+ +
+ +
+ +
(*) Champs obligatoires
+ + + + + + + + + +
+
+
+ + + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSUP/CandidatureEnsup.html b/FormulaireEnsitech_Ensup/ENSUP/CandidatureEnsup.html new file mode 100644 index 0000000..ae11059 --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSUP/CandidatureEnsup.html @@ -0,0 +1,1943 @@ + + + + + + Formulaire de Candidature Oscar School + + + + + + + + +
+
+
+ +
+ +
+

Faisons les présentations !

+

Je renseigne quelques informations pour commencer.

+ +
+
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+ +
+
+ +
+

Projet de formation

+

Je choisis la formation qui m'intéresse et le campus souhaité.

+ +
+
+ +
+
+ +
+
+ +
+
+ + + + +
+
+ +
+ + +
+ +
(*) Champs obligatoires
+ + + + + + + + + +
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSUP/DatalayerEnsup b/FormulaireEnsitech_Ensup/ENSUP/DatalayerEnsup new file mode 100644 index 0000000..6e4b46b --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSUP/DatalayerEnsup @@ -0,0 +1,169 @@ +(function() { + 'use strict'; + + console.log('🔧 DataLayer universel chargé'); + + if (window.location.href.includes('confirmation')) { + console.log('⏭️ Page de confirmation - script ignoré'); + return; + } + + let isProcessing = false; + let lastSubmitTime = 0; + const DEBOUNCE_DELAY = 1000; + + async function sha256(value) { + if (!value) return ''; + try { + const encoder = new TextEncoder(); + const data = encoder.encode(value.trim().toLowerCase()); + const hashBuffer = await crypto.subtle.digest('SHA-256', data); + const hashArray = Array.from(new Uint8Array(hashBuffer)); + return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); + } catch (error) { + console.error('❌ Erreur hashage:', error); + return ''; + } + } + + function getSelectText(selectId) { + const select = document.getElementById(selectId); + if (select && select.selectedIndex >= 0 && select.options[select.selectedIndex]) { + return select.options[select.selectedIndex].text; + } + return ''; + } + + async function captureAndPushDataLayer() { + const now = Date.now(); + if (isProcessing || (now - lastSubmitTime) < DEBOUNCE_DELAY) { + console.warn('⚠️ Envoi ignoré (protection anti-doublon)'); + return; + } + + isProcessing = true; + lastSubmitTime = now; + + console.log('📝 Capture des données formulaire'); + + const consentCheckbox = document.querySelector('input[name="cnil"]:checked'); + if (!consentCheckbox || consentCheckbox.value !== "1") { + console.warn('⚠️ Pas de consentement CNIL - dataLayer non envoyé'); + isProcessing = false; + return; + } + + const typeRaw = (document.querySelector('input[name="type_formulaire"]') || {}).value || ''; + const emailRaw = (document.getElementById('email') || {}).value || ''; + const portableRaw = (document.getElementById('portable') || {}).value || ''; + const villeRaw = (document.getElementById('ville') || {}).value || ''; + const codePostalRaw = (document.getElementById('codepostal') || document.getElementById('code_postal') || {}).value || ''; + const campusRaw = (document.getElementById('campus_selection') || {}).value || ''; + + const statusRaw = getSelectText('OscarContactJeSuisRefIdField'); + const formationRaw = getSelectText('formation'); + + const paysSelect = document.getElementById('pays'); + let paysNom = ''; + if (paysSelect && paysSelect.selectedIndex > 0) { + paysNom = paysSelect.options[paysSelect.selectedIndex].text; + } + + console.log('📦 Données:', { + type: typeRaw, + status: statusRaw, + campus: campusRaw, + formation: formationRaw, + hasEmail: !!emailRaw, + hasPhone: !!portableRaw + }); + + const emailHash = await sha256(emailRaw); + const portableHash = await sha256(portableRaw); + const codePostalHash = await sha256(codePostalRaw); + + const dataLayerObject = { + event: 'form_submit', + type: typeRaw.trim().toLowerCase(), + je_suis: statusRaw.trim(), + sha256_email_address: emailHash, + sha256_phone_number: portableHash, + sha256_postal_code: codePostalHash, + ville: villeRaw.trim(), + pays: paysNom, + campus: campusRaw.trim(), + formation: formationRaw.trim() + }; + + window.dataLayer = window.dataLayer || []; + window.dataLayer.push(dataLayerObject); + + console.log('🚀 DataLayer push réussi:', dataLayerObject); + + setTimeout(() => { + isProcessing = false; + }, 500); + } + + // ✅ INTERCEPTER AXIOS.POST + function interceptAxios() { + if (!window.axios) { + console.warn('⚠️ Axios pas encore chargé, nouvelle tentative...'); + setTimeout(interceptAxios, 100); + return; + } + + console.log('✅ Interception axios configurée'); + + const originalPost = axios.post; + axios.post = async function(...args) { + const url = args[0]; + + // Vérifier si c'est un envoi de formulaire Oscar + if (url && url.includes('oscar-campus.com')) { + console.log('📝 Event: axios.post intercepté'); + await captureAndPushDataLayer(); + } + + // Appeler la fonction originale + return originalPost.apply(this, args); + }; + } + + // ✅ Pour CANDIDATURE : mousedown (car Vue bloque tout) + function attachCandidatureListeners() { + const form = document.getElementById('oscar_school_form'); + if (!form) return; + + const typeInput = document.querySelector('input[name="type_formulaire"]'); + const formType = typeInput ? typeInput.value : ''; + + if (formType === 'candidature') { + console.log('🎯 Mode candidature: ajout mousedown'); + const allSubmitButtons = form.querySelectorAll('button[type="submit"]'); + allSubmitButtons.forEach(btn => { + btn.addEventListener('mousedown', async function(e) { + console.log('📝 Event: mousedown (candidature)'); + await captureAndPushDataLayer(); + }, { capture: true }); + }); + } + } + + // Démarrage + function init() { + console.log('🚀 Initialisation tracking DataLayer'); + + // Intercepter axios (pour JPO, Brochure, Contact) + interceptAxios(); + + // Attacher listeners spécifiques candidature + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', attachCandidatureListeners); + } else { + attachCandidatureListeners(); + } + } + + init(); +})(); \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSUP/formulaireContactEnsup.html b/FormulaireEnsitech_Ensup/ENSUP/formulaireContactEnsup.html new file mode 100644 index 0000000..2c555c7 --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSUP/formulaireContactEnsup.html @@ -0,0 +1,861 @@ + + + + + + Formulaire de contact Oscar School + + + + + + + +
+
+
+ +
+ +
+
+

Une question sur nos formations, l'admission, le campus ou l'alternance ?

+

Veuillez compléter ce formulaire, notre équipe vous recontactera rapidement.

+
+ +
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + + + + +
+
+ +
+ + +
+ +
(*) Champs obligatoires
+ + + + + + + + + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/FormulaireEnsitech_Ensup/ENSUP/jpoEnsup.html b/FormulaireEnsitech_Ensup/ENSUP/jpoEnsup.html new file mode 100644 index 0000000..b386691 --- /dev/null +++ b/FormulaireEnsitech_Ensup/ENSUP/jpoEnsup.html @@ -0,0 +1,1119 @@ + + + + +
+
+
+ +
+
+

Inscription JPO

+

Complétez ce formulaire pour vous inscrire.

+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ + +
+
+ + +
+ + + + + + +
+
+ + +
+ +
+ + +
(*) Champs obligatoires
+ + + + + + + + + + + + +
+
+
+ + + + + + \ No newline at end of file