Skip to content

Commit

Permalink
Merge branch 'master' into vue-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Feb 15, 2021
2 parents 21d6c2d + 007608b commit c019e22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
Expand Down Expand Up @@ -66,6 +67,7 @@
{
"minLength": 3,
"skipWords": [
"cancelled",
"globals",
"googletagmanager",
"gtm",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Provide possibility to override `isInBrowserContext` check ([01f3651])
- Significantly improve JSDoc ([9edc30d])
- Add `vue-router` as `devDependency` for type definition ([593af25])
- Do not track any views if navigation is aborted or cancelled
_You can see logs in the browser console if you have enabled debug mode_
- Fix `vue-router` access `base` from history options
_This only affects Vue 3_

[01f3651]: https://github.com/mib200/vue-gtm/commit/01f3651de1df4f679c60af05697af41b1a38d39b
[9edc30d]: https://github.com/mib200/vue-gtm/commit/9edc30daf0c2bdf542c82d07c2f413421f44de3d
Expand Down
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function initVueRouterGuard(
vueRouter: VueGtmUseOptions["vueRouter"],
ignoredViews: VueGtmUseOptions["ignoredViews"] = [],
trackOnNextTick: VueGtmUseOptions["trackOnNextTick"]
): string[] | undefined {
): void {
if (!vueRouter) {
console.warn("[VueGtm]: You tried to register 'vueRouter' for vue-gtm, but 'vue-router' was not found.");
return;
Expand All @@ -101,7 +101,6 @@ function initVueRouterGuard(
// Flatten routes name
ignoredViews = ignoredViews.map((view) => view.toLowerCase());

// eslint-disable-next-line @typescript-eslint/no-unsafe-call
vueRouter.afterEach((to) => {
// Ignore some routes
if (typeof to.name !== "string" || ignoredViews.indexOf(to.name.toLowerCase()) !== -1) {
Expand All @@ -126,8 +125,6 @@ function initVueRouterGuard(
gtmPlugin?.trackView(name, fullUrl, additionalEventData);
}
});

return ignoredViews;
}

declare module "vue/types/vue" {
Expand Down

0 comments on commit c019e22

Please sign in to comment.