mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
fix(website): Use GTM for conversion tracking (#7154)
This commit is contained in:
@@ -2,10 +2,9 @@
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { HubSpotSubmittedFormData } from "./types";
|
||||
import { sendGTMEvent } from "@next/third-parties/google";
|
||||
|
||||
export default function GoogleAds() {
|
||||
const trackingId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID;
|
||||
|
||||
useEffect(() => {
|
||||
const handleMessage = (event: MessageEvent) => {
|
||||
if (
|
||||
@@ -22,11 +21,12 @@ export default function GoogleAds() {
|
||||
return;
|
||||
};
|
||||
|
||||
(window as any).gtag("event", "conversion", {
|
||||
send_to: `${trackingId}/1wX_CNmzg7MZEPyK3OA9`,
|
||||
value: Number(formData.submissionValues["0-2/numberofemployees"]) * 5,
|
||||
currency: "USD",
|
||||
event_callback: callback,
|
||||
const value =
|
||||
Number(formData.submissionValues["0-2/numberofemployees"]) * 5;
|
||||
|
||||
sendGTMEvent({
|
||||
event: "hubspot-form-submitted",
|
||||
conversionValue: value,
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -36,7 +36,7 @@ export default function GoogleAds() {
|
||||
return () => {
|
||||
window.removeEventListener("message", handleMessage);
|
||||
};
|
||||
}, [trackingId]);
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user