Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

94
Vistas
How to send dynamic value to the webengage event using React js

I have been trying to add the dynamic value to the WebEngage but failed,

    webengage.track("Added To Cart", {
        courseName: "JS Advanced",
        courseType: "A",
        coursePrice: "N/A",
        discount: "N/A",
        pageScroll: "5" // this will be vary between 0 to 100
    });

I am able to track the static values but the dynamic value is not getting tracked on webengage using React js.

Think I had tried till now are:

  1. React cleanup function.

    useEffect(() => (window as any).webengage.track("Page Viewed", {...webengageData}), []);

  1. JS beforeUnload event.
    useEffect(() => {
        window.addEventListener("beforeUnload", handleWebengge);
        return () => {
          window.removeEventListener("beforeUnload", handleWebengge);
          handleWebengge();
        };
      }, []);
    
      const handleWebengge = () => {
        (window as any).webengage.track("Page Viewed", webengageData);
      };

  1. JS unload event
    useEffect(() => {
        window.addEventListener("unload", handleWebengge);
        return () => {
          window.removeEventListener("unload", handleWebengge);
          handleWebengge();
        };
      }, []); 

  const handleWebengge = () => {
    (window as any).webengage.track("Page Viewed", webengageData);
  };

Is there a way when I close or move to other pages I can hit the event and track the event in React.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda