Skip to content

Commit

Permalink
Run Matomo pageview tracking only when url changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atas committed Oct 21, 2024
1 parent 3c62929 commit 7fc690f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
10 changes: 5 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
createClass: 'createReactClass', // Regex for Component Factory to use,
// default to "createReactClass"
pragma: 'React', // Pragma to use, default to "React"
fragment: 'Fragment', // Fragment to use (maybe a property of <pragma>), default to "Fragment"
fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment"
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
propWrapperFunctions: [
Expand Down Expand Up @@ -45,12 +45,12 @@ module.exports = {
},
ecmaVersion: 2018,
sourceType: 'module',
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
project: './tsconfig.json',
},
plugins: ['react', '@typescript-eslint', 'promise'],
plugins: ['react', '@typescript-eslint', 'promise', 'unused-imports'],
rules: {
indent: ['error', 'tab'],
'unused-imports/no-unused-imports': 'error',
indent: ['error', 'tab', { SwitchCase: 1 }],
'no-tabs': 0,
semi: 'off',
'require-await': 'off', // disabled in favour of @typescript-eslint/require-await
Expand Down
42 changes: 30 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-unused-imports": "^4.1.4",
"jest": "^29.7.0",
"npm-check": "^6.0.1",
"prettier": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/PageViewTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useMatomoPageView = () => {
_paq.push(['setCustomUrl', window.location.href]);
_paq.push(['trackPageView']);
}
}, [location]);
}, [location.pathname.toString(), location.search.toString()]);
};

/**
Expand Down

0 comments on commit 7fc690f

Please sign in to comment.