Skip to content

Commit

Permalink
feat(sdk-analytics) clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
oidacra committed Dec 17, 2024
1 parent 267005b commit 5cf2435
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 9 additions & 1 deletion core-web/libs/sdk/analytics/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
"@nx/dependency-checks": [
"error",
{
"ignoredDependencies": [
"@testing-library/jest-dom",
"@testing-library/react"
]
}
]
}
}
]
Expand Down
7 changes: 5 additions & 2 deletions core-web/libs/sdk/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
"homepage": "https://github.com/dotCMS/core/tree/main/core-web/libs/sdk/analytics/README.md",
"dependencies": {
"analytics": "^0.8.14",
"vite": "~5.0.0",
"@testing-library/jest-dom": "^6.1.6"
"vite": "~5.0.0"
},
"peerDependencies": {
"react": "^18.2.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.1.6",
"@testing-library/react": "^14.0.0"
},
"main": "./index.cjs.js",
"module": "./index.esm.js",
"exports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export function useRouterTracker(analytics: DotContentAnalytics | null) {

function handleRouteChange() {
const currentPath = window.location.pathname;
if (currentPath !== lastPathRef.current && !isInsideEditor()) {
if (currentPath !== lastPathRef.current && !isInsideEditor() && analytics) {
lastPathRef.current = currentPath;
analytics!.pageView();
analytics.pageView();
}
}

Expand Down

0 comments on commit 5cf2435

Please sign in to comment.