Home / File/ web-analytics.ts — astro Source File

web-analytics.ts — astro Source File

Architecture documentation for web-analytics.ts, a typescript file in the astro codebase.

Entity Profile

Relationship Graph

Source Code

export type VercelWebAnalyticsConfig = {
	enabled: boolean;
};

export async function getInjectableWebAnalyticsContent({
	mode,
}: {
	mode: 'development' | 'production';
}) {
	const base = `window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };`;

	if (mode === 'development') {
		return `
			${base}
			var script = document.createElement('script');
			script.defer = true;
			script.src = 'https://cdn.vercel-insights.com/v1/script.debug.js';
			var head = document.querySelector('head');
			head.appendChild(script);
		`;
	}

	return `${base}
		var script = document.createElement('script');
		script.defer = true;
		script.src = '/_vercel/insights/script.js';
		var head = document.querySelector('head');
		head.appendChild(script);
	`;
}

Domain

Subdomains

Frequently Asked Questions

What does web-analytics.ts do?
web-analytics.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in web-analytics.ts?
web-analytics.ts defines 1 function(s): getInjectableWebAnalyticsContent.
Where is web-analytics.ts in the architecture?
web-analytics.ts is located at packages/integrations/vercel/src/lib/web-analytics.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/vercel/src/lib).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free