Merge pull request 'feat: add google ads tag' (#12) from vi into main

Reviewed-on: #12
This commit is contained in:
hoangvi.ng 2026-06-16 12:08:34 +10:00
commit 70f1d3d27d
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>