diff --git a/modules/Layout/SubscribeForm/SubscribeForm.tsx b/modules/Layout/SubscribeForm/SubscribeForm.tsx index 142b3676..a3accd29 100644 --- a/modules/Layout/SubscribeForm/SubscribeForm.tsx +++ b/modules/Layout/SubscribeForm/SubscribeForm.tsx @@ -1,4 +1,5 @@ import HCaptcha from '@hcaptcha/react-hcaptcha'; +import { ACTIONS, useAnalytics } from '@prezly/analytics-nextjs'; import { getPrivacyPortalUrl } from '@prezly/theme-kit-core'; import { translations } from '@prezly/theme-kit-intl'; import { useCurrentLocale, useNewsroom } from '@prezly/theme-kit-nextjs'; @@ -18,6 +19,7 @@ const NEXT_PUBLIC_HCAPTCHA_SITEKEY = process.env.NEXT_PUBLIC_HCAPTCHA_SITEKEY; function SubscribeForm() { const newsroom = useNewsroom(); const currentLocale = useCurrentLocale(); + const { track } = useAnalytics(); const { formatMessage } = useIntl(); const captchaRef = useRef(null); @@ -55,6 +57,7 @@ function SubscribeForm() { return; } + track(ACTIONS.SUBSCRIBE_FORM_SUBMIT); window.location.href = getPrivacyPortalUrl(newsroom, currentLocale, { email }); } catch (error) { if (error instanceof Error) { diff --git a/package-lock.json b/package-lock.json index c78a403e..fbd26bd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@hcaptcha/react-hcaptcha": "1.9.3", "@headlessui/react": "1.7.18", "@playwright/test": "^1.33.0", - "@prezly/analytics-nextjs": "2.0.0", + "@prezly/analytics-nextjs": "2.0.1", "@prezly/content-renderer-react-js": "0.35.0", "@prezly/sdk": "18.3.0", "@prezly/story-content-format": "0.64.0", @@ -2648,9 +2648,9 @@ "dev": true }, "node_modules/@prezly/analytics-nextjs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@prezly/analytics-nextjs/-/analytics-nextjs-2.0.0.tgz", - "integrity": "sha512-E3pTHDPtO7TCQcrrB5pTZ/2fhIHV3Ln3ALEDkqkNQEuuYFgItvwK0pjgHNTAcG5xL/Ibtx+9jwtnEq2+ulDsow==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@prezly/analytics-nextjs/-/analytics-nextjs-2.0.1.tgz", + "integrity": "sha512-v6RfZcP4xqXrWkngUZdTa4ib6fI7t0t2O+WOpiK8zYJt4q1J460wdog5DOBgqE05aZcEFAJH7XwT8DWolESDaQ==", "dependencies": { "@react-hookz/web": "^14.2.2", "@segment/analytics-next": "^1.66.0", @@ -19244,9 +19244,9 @@ "dev": true }, "@prezly/analytics-nextjs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@prezly/analytics-nextjs/-/analytics-nextjs-2.0.0.tgz", - "integrity": "sha512-E3pTHDPtO7TCQcrrB5pTZ/2fhIHV3Ln3ALEDkqkNQEuuYFgItvwK0pjgHNTAcG5xL/Ibtx+9jwtnEq2+ulDsow==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@prezly/analytics-nextjs/-/analytics-nextjs-2.0.1.tgz", + "integrity": "sha512-v6RfZcP4xqXrWkngUZdTa4ib6fI7t0t2O+WOpiK8zYJt4q1J460wdog5DOBgqE05aZcEFAJH7XwT8DWolESDaQ==", "requires": { "@react-hookz/web": "^14.2.2", "@segment/analytics-next": "^1.66.0", diff --git a/package.json b/package.json index 864b07e5..2a7e239b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@hcaptcha/react-hcaptcha": "1.9.3", "@headlessui/react": "1.7.18", "@playwright/test": "^1.33.0", - "@prezly/analytics-nextjs": "2.0.0", + "@prezly/analytics-nextjs": "2.0.1", "@prezly/content-renderer-react-js": "0.35.0", "@prezly/sdk": "18.3.0", "@prezly/story-content-format": "0.64.0",