track going to checkout page as a conversion for Google ads

This commit is contained in:
Abi Raja 2024-07-29 17:15:35 -04:00
parent 64a4ab8c90
commit 3d44c4406d
3 changed files with 13 additions and 0 deletions

View File

@ -35,6 +35,7 @@
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@stripe/stripe-js": "^2.2.2",
"@types/gtag.js": "^0.0.20",
"class-variance-authority": "^0.7.0",
"classnames": "^2.3.2",
"clsx": "^2.0.0",

View File

@ -34,6 +34,13 @@ export default function useStripeCheckout() {
"POST"
);
// Track going to checkout page as a conversion
gtag("event", "conversion", {
send_to: "AW-16649848443/cFfeCP_Xw8QZEPuMooM-",
value: 1.0,
currency: "USD",
});
// Redirect to Stripe Checkout
const { error } = await stripe.redirectToCheckout({
sessionId: res.sessionId,

View File

@ -1950,6 +1950,11 @@
dependencies:
"@types/node" "*"
"@types/gtag.js@^0.0.20":
version "0.0.20"
resolved "https://registry.yarnpkg.com/@types/gtag.js/-/gtag.js-0.0.20.tgz#e47edabb4ed5ecac90a079275958e6c929d7c08a"
integrity sha512-wwAbk3SA2QeU67unN7zPxjEHmPmlXwZXZvQEpbEUQuMCRGgKyE1m6XDuTUA9b6pCGb/GqJmdfMOY5LuDjJSbbg==
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7"