diff --git a/packages/web/package.json b/packages/web/package.json index e4a70e6..e20ba1f 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@vercel/analytics", - "version": "1.1.2", + "version": "1.1.3", "description": "Gain real-time traffic insights with Vercel Web Analytics", "keywords": [ "analytics", diff --git a/packages/web/src/server/index.ts b/packages/web/src/server/index.ts index 213045d..72a3303 100644 --- a/packages/web/src/server/index.ts +++ b/packages/web/src/server/index.ts @@ -35,8 +35,11 @@ export async function track( properties?: Record, context?: Context ): Promise { - const ENDPOINT = process.env.VERCEL_URL || process.env.VERCEL_ANALYTICS_URL; + const ENDPOINT = + process.env.VERCEL_WEB_ANALYTICS_ENDPOINT || process.env.VERCEL_URL; const DISABLE_LOGS = Boolean(process.env.VERCEL_WEB_ANALYTICS_DISABLE_LOGS); + const BYPASS_SECRET = process.env.VERCEL_AUTOMATION_BYPASS_SECRET; + if (typeof window !== 'undefined') { if (!isProduction()) { throw new Error( @@ -125,6 +128,9 @@ export async function track( : { 'x-va-server': '2', }), + ...(BYPASS_SECRET + ? { 'x-vercel-protection-bypass': BYPASS_SECRET } + : {}), }, body: JSON.stringify(body), method: 'POST',