@shopana/ga
Version:
Type-safe Google Analytics 4 (GA4) tracking library for React and Next.js with ecommerce support, event batching, and SSR compatibility
19 lines • 600 B
JavaScript
import {} from '../types/common';
import {} from '../types/events';
export function buildPageViewEvent(params) {
if (!params.measurementId) {
throw new Error('measurementId is required for page views');
}
return {
name: 'page_view',
measurementId: params.measurementId,
params: {
page_title: params.title,
page_location: params.location ?? params.path,
page_path: params.path,
page_referrer: params.referrer,
language: params.language,
},
};
}
//# sourceMappingURL=pageTracking.js.map