Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda