mirror of
https://github.com/ershisan99/vacancies-trends-front.git
synced 2025-12-16 20:59:25 +00:00
add analytics
This commit is contained in:
6
.idea/git_toolbox_blame.xml
generated
Normal file
6
.idea/git_toolbox_blame.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitToolBoxBlameSettings">
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -4,15 +4,28 @@
|
|||||||
* For more information, see https://remix.run/file-conventions/entry.client
|
* For more information, see https://remix.run/file-conventions/entry.client
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { RemixBrowser } from "@remix-run/react";
|
import { RemixBrowser } from '@remix-run/react'
|
||||||
import { startTransition, StrictMode } from "react";
|
import { startTransition, StrictMode, useEffect } from 'react'
|
||||||
import { hydrateRoot } from "react-dom/client";
|
import { hydrateRoot } from 'react-dom/client'
|
||||||
|
import posthog from 'posthog-js'
|
||||||
|
|
||||||
|
function PosthogInit() {
|
||||||
|
useEffect(() => {
|
||||||
|
posthog.init(import.meta.env.VITE_PH_API_KEY, {
|
||||||
|
api_host: import.meta.env.VITE_PH_API_HOST,
|
||||||
|
person_profiles: 'identified_only',
|
||||||
|
capture_pageview: false,
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
hydrateRoot(
|
hydrateRoot(
|
||||||
document,
|
document,
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<RemixBrowser />
|
<RemixBrowser />
|
||||||
|
<PosthogInit />
|
||||||
</StrictMode>
|
</StrictMode>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
28
app/root.tsx
28
app/root.tsx
@@ -1,7 +1,16 @@
|
|||||||
import { LinksFunction } from '@remix-run/node'
|
import { LinksFunction } from '@remix-run/node'
|
||||||
import { Link, Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'
|
import {
|
||||||
|
Link,
|
||||||
|
Links,
|
||||||
|
Meta,
|
||||||
|
Outlet,
|
||||||
|
Scripts,
|
||||||
|
ScrollRestoration,
|
||||||
|
useLocation,
|
||||||
|
} from '@remix-run/react'
|
||||||
import stylesheet from '~/tailwind.css?url'
|
import stylesheet from '~/tailwind.css?url'
|
||||||
import { PropsWithChildren } from 'react'
|
import { PropsWithChildren, useEffect } from 'react'
|
||||||
|
import posthog from 'posthog-js'
|
||||||
|
|
||||||
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]
|
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]
|
||||||
|
|
||||||
@@ -35,5 +44,18 @@ export function Layout({ children }: PropsWithChildren) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return <Outlet />
|
return (
|
||||||
|
<>
|
||||||
|
<CapturePageView />
|
||||||
|
<Outlet />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function CapturePageView() {
|
||||||
|
const location = useLocation()
|
||||||
|
useEffect(() => {
|
||||||
|
posthog.capture('$pageview')
|
||||||
|
}, [location])
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"@tremor/react": "^3.17.2",
|
"@tremor/react": "^3.17.2",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"isbot": "^4.1.0",
|
"isbot": "^4.1.0",
|
||||||
|
"posthog-js": "^1.148.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"tailwind-merge": "^2.3.0"
|
"tailwind-merge": "^2.3.0"
|
||||||
|
|||||||
27
pnpm-lock.yaml
generated
27
pnpm-lock.yaml
generated
@@ -38,6 +38,9 @@ importers:
|
|||||||
isbot:
|
isbot:
|
||||||
specifier: ^4.1.0
|
specifier: ^4.1.0
|
||||||
version: 4.4.0
|
version: 4.4.0
|
||||||
|
posthog-js:
|
||||||
|
specifier: ^1.148.0
|
||||||
|
version: 1.148.0
|
||||||
react:
|
react:
|
||||||
specifier: ^18.2.0
|
specifier: ^18.2.0
|
||||||
version: 18.3.1
|
version: 18.3.1
|
||||||
@@ -2013,6 +2016,9 @@ packages:
|
|||||||
fault@2.0.1:
|
fault@2.0.1:
|
||||||
resolution: {integrity: sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==}
|
resolution: {integrity: sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==}
|
||||||
|
|
||||||
|
fflate@0.4.8:
|
||||||
|
resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==}
|
||||||
|
|
||||||
file-entry-cache@6.0.1:
|
file-entry-cache@6.0.1:
|
||||||
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
|
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
|
||||||
engines: {node: ^10.12.0 || >=12.0.0}
|
engines: {node: ^10.12.0 || >=12.0.0}
|
||||||
@@ -3105,6 +3111,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==}
|
resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
|
posthog-js@1.148.0:
|
||||||
|
resolution: {integrity: sha512-nydf+aret26YViDBwH7DdN/c8dmCzQGNQ1yredeE47UlbpJ3J/iTgskNdmGJIofFcdSagcwAE/FF7s++YfTtvg==}
|
||||||
|
|
||||||
|
preact@10.22.1:
|
||||||
|
resolution: {integrity: sha512-jRYbDDgMpIb5LHq3hkI0bbl+l/TQ9UnkdQ0ww+lp+4MMOdqaUYdFc5qeyP+IV8FAd/2Em7drVPeKdQxsiWCf/A==}
|
||||||
|
|
||||||
prelude-ls@1.2.1:
|
prelude-ls@1.2.1:
|
||||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
@@ -3815,6 +3827,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
|
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|
||||||
|
web-vitals@4.2.1:
|
||||||
|
resolution: {integrity: sha512-U6bAxeudnhDqcXNl50JC4hLlqox9DZnngxfISZm3DMZnonW35xtJOVUc091L+DOY+6hVZVpKXoiCP0RiT6339Q==}
|
||||||
|
|
||||||
which-boxed-primitive@1.0.2:
|
which-boxed-primitive@1.0.2:
|
||||||
resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==}
|
resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==}
|
||||||
|
|
||||||
@@ -6076,6 +6091,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
format: 0.2.2
|
format: 0.2.2
|
||||||
|
|
||||||
|
fflate@0.4.8: {}
|
||||||
|
|
||||||
file-entry-cache@6.0.1:
|
file-entry-cache@6.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
flat-cache: 3.2.0
|
flat-cache: 3.2.0
|
||||||
@@ -7323,6 +7340,14 @@ snapshots:
|
|||||||
picocolors: 1.0.1
|
picocolors: 1.0.1
|
||||||
source-map-js: 1.2.0
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
|
posthog-js@1.148.0:
|
||||||
|
dependencies:
|
||||||
|
fflate: 0.4.8
|
||||||
|
preact: 10.22.1
|
||||||
|
web-vitals: 4.2.1
|
||||||
|
|
||||||
|
preact@10.22.1: {}
|
||||||
|
|
||||||
prelude-ls@1.2.1: {}
|
prelude-ls@1.2.1: {}
|
||||||
|
|
||||||
prettier@2.8.8: {}
|
prettier@2.8.8: {}
|
||||||
@@ -8182,6 +8207,8 @@ snapshots:
|
|||||||
|
|
||||||
web-streams-polyfill@3.3.3: {}
|
web-streams-polyfill@3.3.3: {}
|
||||||
|
|
||||||
|
web-vitals@4.2.1: {}
|
||||||
|
|
||||||
which-boxed-primitive@1.0.2:
|
which-boxed-primitive@1.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-bigint: 1.0.4
|
is-bigint: 1.0.4
|
||||||
|
|||||||
Reference in New Issue
Block a user