vue-gtag-next is a plugin designed for Vue 3 to integrate Google's Global Site Tag (gtag.js), enabling event data collection for services like Google Analytics and Google Ads. The package's current stable version is 1.14.0, last released in October 2020. According to its README from that period, it explicitly stated "it's not production ready" and was developed when "Vue 3 is not out yet." This indicates that development ceased early in Vue 3's lifecycle, and the package has not received updates to keep pace with subsequent Vue 3 releases or changes in gtag.js. Its release cadence has effectively stopped. While it aimed to provide a convenient wrapper for gtag.js within a Vue 3 application, its unmaintained status and early development phase mean it lacks long-term support and may have compatibility issues with current Vue 3 versions, making it a potentially risky choice for modern applications compared to actively maintained alternatives.
npm install vue-gtag-nextVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the VueGtagNext plugin with a Google Analytics ID and demonstrates sending both a page view event and a custom event from a Vue 3 component using the Composition API's `useGtag` hook.
Consider using an actively maintained Google Analytics integration for Vue 3, or implement gtag.js manually until this package receives updates or an alternative emerges.
Always cross-reference your tracking implementation with the official gtag.js documentation to ensure accuracy. Manually verify data in Google Analytics.
Assess the security implications carefully. For critical applications, prefer actively maintained libraries or direct gtag.js integration.
Ensure the VueGtagNext plugin is correctly installed with `app.use()` and that the `property.id` configuration is valid. Check network requests to confirm `gtag.js` is loading.
Ensure you are importing `createApp` from 'vue' and calling `createApp(App)` to create your application instance before calling `app.use()`.
Ensure `app.use(VueGtagNext, { ... })` is called before your component that uses `useGtag` is mounted. Call `useGtag()` only within the `setup()` function of a Vue component.