Skip to content

Commit

Permalink
Replace includedDomains & excludedDomains with Allowed Domains
Browse files Browse the repository at this point in the history
  • Loading branch information
AshWills committed Oct 27, 2023
1 parent 5ab5dbc commit 7b33b58
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ Injects the Fathom script into the DOM and loads the script asynchronously.
- `auto` - When `false`, skips automatically tracking page views on script load (defaults to `true`).
- `honorDNT` - When `true`, honors the [DNT header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/DNT) in the visitor's browser
- `canonical` - When `false`, ignores the canonical tag if present (defaults to `true`).
- `includedDomains` - Only tracks when on one of these domains.
- `excludedDomains` - Only tracks when NOT on one of these domains.
- `spa` - Accepts one of the following values: `auto`, `history`, or `hash` (see [advanced docs](https://usefathom.com/support/tracking-advanced)).

#### Example
Expand All @@ -69,7 +67,7 @@ Injects the Fathom script into the DOM and loads the script asynchronously.
import { load } from 'fathom-client';

load('MY_FATHOM_ID', {
includedDomains: ['example.com']
// Add options here
});
```

Expand Down Expand Up @@ -205,6 +203,11 @@ load('MY_FATHOM_ID');
setSite('A_DIFFERENT_FATHOM_ID');
```

## Allowed Domains
Manage your allowed domains within your Fathom site's Firewall settings. Doing so enables the usage of wildcards (e.g., *.example.com). See https://usefathom.com/docs/script/firewall#allowed

The 'includedDomains' and 'excludedDomains' options, while deprecated, are still supported to ensure backward compatibility.

## Usage

This library is JavaScript framework-agnostic. Below are some usage examples with popular frameworks.
Expand Down Expand Up @@ -233,7 +236,7 @@ function App({ Component, pageProps }) {
// Initialize Fathom when the app loads
useEffect(() => {
Fathom.load('MY_FATHOM_ID', {
includedDomains: ['yourwebsite.com']
// Add options here
});
}, []);

Expand Down Expand Up @@ -262,7 +265,6 @@ function TrackPageView() {
// Load the Fathom script on mount
useEffect(() => {
load('MY_FATHOM_ID', {
includedDomains: ['yourwebsite.com'],
auto: false
});
}, []);
Expand Down Expand Up @@ -325,7 +327,7 @@ The `load` function also accepts an object of options:

```js
Fathom.load('MY_FATHOM_ID', {
includedDomains: ['yourwebsite.com']
// Add options here
});
```

Expand Down

0 comments on commit 7b33b58

Please sign in to comment.