diff --git a/src/pages/home/_components/AppsGrid.jsx b/src/pages/home/_components/AppsGrid.jsx index 387efec5f..4592c241f 100644 --- a/src/pages/home/_components/AppsGrid.jsx +++ b/src/pages/home/_components/AppsGrid.jsx @@ -3,6 +3,9 @@ import Link from '@docusaurus/Link'; import { useColorMode } from '@docusaurus/theme-common'; import clsx from 'clsx'; import styles from './AppsGrid.module.scss'; +import { addUTM } from '../../../util/addUTM'; + +const utm = addUTM('home_page'); export default function AppsGrid({ list }) { const { isDarkTheme } = useColorMode(); @@ -11,7 +14,7 @@ export default function AppsGrid({ list }) {
{list.map((item) => ( diff --git a/src/util/addUTM.js b/src/util/addUTM.js new file mode 100644 index 000000000..882f3b5fc --- /dev/null +++ b/src/util/addUTM.js @@ -0,0 +1,17 @@ +/** + * + * @param {string} utmMedium + * @returns {(urlAddress: string) => string} + */ +export function addUTM(utmMedium) { + /** + * @param {string} urlAddress + */ + return function (urlAddress) { + const url = new URL(urlAddress); + url.searchParams.append('utm_source', 'electron'); + url.searchParams.append('utm_medium', utmMedium); + + return url.toString(); + }; +}