Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#157): error when rendering Nuxt component #160

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vercel/analytics",
"version": "1.5.0-canary.1",
"version": "1.4.1",
"description": "Gain real-time traffic insights with Vercel Web Analytics",
"keywords": [
"analytics",
Expand Down
4 changes: 0 additions & 4 deletions packages/web/src/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export const DEV_SCRIPT_URL =
'https://va.vercel-scripts.com/v1/script.debug.js';
export const PROD_SCRIPT_URL = '/_vercel/insights/script.js';

export const basepathVariableName = 'NEXT_PUBLIC_WEB_ANALYTICS_BASEPATH';

/**
* Injects the Vercel Web Analytics script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/concepts/analytics/package).
* @param [props] - Analytics options.
Expand Down Expand Up @@ -69,8 +67,6 @@ function inject(
}
if (props.endpoint) {
script.dataset.endpoint = props.endpoint;
} else if (process.env[basepathVariableName]) {
script.dataset.endpoint = `/${process.env[basepathVariableName]}/_vercel/insights`;
}
if (props.dsn) {
script.dataset.dsn = props.dsn;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/vue/create-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createComponent(
framework,
});
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project.
if (route && window) {
if (route && typeof window !== 'undefined') {
const changeRoute = (): void => {
pageview({
route: computeRoute(route.path, route.params),
Expand Down
Loading