vue-gtm
vue-gtm copied to clipboard
Bug: vue-router in createGtm has unnecessary type, "listening"
Info
| Tool | Version |
|---|---|
| Plugin | v1.6.0 |
| Vue | v4.0.12 |
| Vue-Router | v3.2.31 |
| Node | v16.15.0 |
| OS | win(WSL) |
Input
Vue Router has type error
createGtm({
id: 'GTM-xxxxxx', // Your GTM single container ID, array of container ids ['GTM-xxxxxx', 'GTM-yyyyyy'] or array of objects [{id: 'GTM-xxxxxx', queryParams: { gtm_auth: 'abc123', gtm_preview: 'env-4', gtm_cookies_win: 'x'}}, {id: 'GTM-yyyyyy', queryParams: {gtm_auth: 'abc234', gtm_preview: 'env-5', gtm_cookies_win: 'x'}}], // Your GTM single container ID or array of container ids ['GTM-xxxxxx', 'GTM-yyyyyy']
defer: false, // Script can be set to `defer` to speed up page load at the cost of less accurate results (in case visitor leaves before script is loaded, which is unlikely but possible). Defaults to false, so the script is loaded `async` by default
compatibility: false, // Will add `async` and `defer` to the script tag to not block requests for old browsers that do not support `async`
nonce: '2726c7f26c', // Will add `nonce` to the script tag
enabled: true, // defaults to true. Plugin can be disabled by setting this to false for Ex: enabled: !!GDPR_Cookie (optional)
debug: true, // Whether or not display console logs debugs (optional)
loadScript: true, // Whether or not to load the GTM Script (Helpful if you are including GTM manually, but need the dataLayer functionality in your components) (optional)
vueRouter: router, // Pass the router instance to automatically sync with router (optional)
ignoredViews: ['homepage'], // Don't trigger events for specified router names (optional)
trackOnNextTick: false, // Whether or not call trackView in Vue.nextTick
})
Output or Error
TS2741: Property 'listening' is missing in type 'import(".../node_modules/vue-router/dist/vue-router").Router' but required in type 'import(".../node_modules/@gtm-support/vue-gtm/node_modules/vue-router/dist/vue-router").Router'.
Expected Output
no type error
Additional Context
I highly suggest to try to tackle this with a PR from your side, or create a reproducible (e.g. via stackblitz) that helps to debug this error
Could you test with https://github.com/gtm-support/vue-gtm/releases/tag/2.0.0-beta.3
I release 2.0.0 Please reopen if anything broke