feat: add google ads tag

This commit is contained in:
Hoang Vi 2026-06-16 09:07:41 +07:00
parent 3c16b588e1
commit b25f49f32a
2 changed files with 18 additions and 0 deletions

View File

@ -136,6 +136,10 @@
const data = await res.json(); const data = await res.json();
if (res.ok && data.ok) { if (res.ok && data.ok) {
// Google Ads conversion — fires only on a successful submit
if (typeof gtag_report_conversion === "function") {
gtag_report_conversion();
}
onSuccess(restore); onSuccess(restore);
} else { } else {
let msg = data.error || "Something went wrong. Please try again."; let msg = data.error || "Something went wrong. Please try again.";

View File

@ -118,6 +118,20 @@
} }
gtag('js', new Date()) gtag('js', new Date())
gtag('config', 'G-YG35M09CR8') gtag('config', 'G-YG35M09CR8')
gtag('config', 'AW-18202371431');
</script>
<!-- Event snippet for Outbound click conversion page In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof url != "undefined") {
window.location = url;
}
};
gtag("event", "conversion", { send_to: "AW-18202371431/hhXcCOCRvb0cEOfKyOdD", value: 1.0, currency: "AUD", event_callback: callback });
return false;
}
</script> </script>
</head> </head>