xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}
xxxxxxxxxx
import { useRouter } from 'vitepress';
const router = useRouter();
// Only run this on the client. Not during build.
if (typeof window !== 'undefined' && window.ga) {
watch(() => router.route.data.relativePath, (path) => {
ga('send', 'pageview', path);
}, { immediate: true });
}