fathom-client
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -167,2 +167,10 @@ 'use strict'; | ||
/** | ||
* Checks if tracking is enabled for the current vistior | ||
*/ | ||
var isTrackingEnabled = function isTrackingEnabled() { | ||
var preferenceStorage = localStorage.getItem('blockFathomTracking'); | ||
return preferenceStorage !== null ? preferenceStorage !== 'true' : true; | ||
}; | ||
/** | ||
* Sets the Site ID. | ||
@@ -186,2 +194,3 @@ * | ||
exports.enableTrackingForMe = enableTrackingForMe; | ||
exports.isTrackingEnabled = isTrackingEnabled; | ||
exports.load = load; | ||
@@ -188,0 +197,0 @@ exports.setSite = setSite; |
@@ -163,2 +163,10 @@ // refer to https://usefathom.com/support/tracking-advanced | ||
/** | ||
* Checks if tracking is enabled for the current vistior | ||
*/ | ||
var isTrackingEnabled = function isTrackingEnabled() { | ||
var preferenceStorage = localStorage.getItem('blockFathomTracking'); | ||
return preferenceStorage !== null ? preferenceStorage !== 'true' : true; | ||
}; | ||
/** | ||
* Sets the Site ID. | ||
@@ -180,2 +188,2 @@ * | ||
export { blockTrackingForMe, enableTrackingForMe, load, setSite, trackGoal, trackPageview }; | ||
export { blockTrackingForMe, enableTrackingForMe, isTrackingEnabled, load, setSite, trackGoal, trackPageview }; |
@@ -69,2 +69,6 @@ interface Fathom { | ||
/** | ||
* Checks if tracking is enabled for the current vistior | ||
*/ | ||
export declare const isTrackingEnabled: () => boolean; | ||
/** | ||
* Sets the Site ID. | ||
@@ -71,0 +75,0 @@ * |
{ | ||
"name": "fathom-client", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "A simple wrapper around the Fathom Analytics library", | ||
@@ -51,2 +51,8 @@ "keywords": [ | ||
}, | ||
"jest": { | ||
"resetMocks": false, | ||
"setupFiles": [ | ||
"jest-localstorage-mock" | ||
] | ||
}, | ||
"devDependencies": { | ||
@@ -59,2 +65,3 @@ "@babel/core": "^7.6.4", | ||
"jest": "^27.4", | ||
"jest-localstorage-mock": "^2.4.21", | ||
"lint-staged": "^12.1.7", | ||
@@ -61,0 +68,0 @@ "np": "^7.6.0", |
@@ -147,2 +147,24 @@ # Fathom Client [![CircleCI](https://circleci.com/gh/derrickreimer/fathom-client.svg?style=svg)](https://circleci.com/gh/derrickreimer/fathom-client) | ||
### `isTrackingEnabled()` | ||
Checks if tracking is enabled for the current visitor. | ||
See https://usefathom.com/docs/features/exclude. | ||
#### Arguments | ||
None. | ||
#### Returns | ||
Boolean. | ||
#### Example | ||
```js | ||
import { isTrackingEnabled } from 'fathom-client'; | ||
const check = isTrackingEnabled(); // `true` by default | ||
``` | ||
### `setSite(id: string)` | ||
@@ -180,4 +202,6 @@ | ||
// Record a pageview when route changes | ||
Router.events.on('routeChangeComplete', () => { | ||
Fathom.trackPageview(); | ||
Router.events.on('routeChangeComplete', (as, routeProps) => { | ||
if (!routeProps.shallow) { | ||
Fathom.trackPageview(); | ||
} | ||
}); | ||
@@ -184,0 +208,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20880
408
248
16