forked from fingerprintjs/fingerprintjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the OSS-pro comparison table (fingerprintjs#649)
- Loading branch information
Showing
4 changed files
with
158 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# API reference | ||
|
||
## Installation | ||
|
||
The library is shipped in various formats: | ||
|
||
### Global variable | ||
|
||
```html | ||
<script> | ||
function initFingerprintJS() { | ||
// Start loading FingerprintJS here | ||
} | ||
</script> | ||
<script | ||
async | ||
src="//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3/dist/fp.min.js" | ||
onload="initFingerprintJS()" | ||
></script> | ||
``` | ||
|
||
### UMD | ||
|
||
```js | ||
require( | ||
['//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3/dist/fp.umd.min.js'], | ||
(FingerprintJS) => { | ||
// Start loading FingerprintJS here | ||
} | ||
) | ||
``` | ||
|
||
### ECMAScript module | ||
|
||
```bash | ||
# Install the package first: | ||
npm i @fingerprintjs/fingerprintjs | ||
# or | ||
yarn add @fingerprintjs/fingerprintjs | ||
``` | ||
|
||
```js | ||
import FingerprintJS from '@fingerprintjs/fingerprintjs' | ||
|
||
// Start loading FingerprintJS here | ||
``` | ||
|
||
### CommonJS | ||
|
||
```bash | ||
# Install the package first: | ||
npm i @fingerprintjs/fingerprintjs | ||
# or | ||
yarn add @fingerprintjs/fingerprintjs | ||
``` | ||
|
||
```js | ||
const FingerprintJS = require('@fingerprintjs/fingerprintjs') | ||
|
||
// Start loading FingerprintJS here | ||
``` | ||
|
||
## API | ||
|
||
#### `FingerprintJS.load({ delayFallback?: number }): Promise<Agent>` | ||
|
||
Builds an instance of Agent and waits a delay required for a proper operation. | ||
We recommend calling it as soon as possible. | ||
`delayFallback` is an optional parameter that sets duration (milliseconds) of the fallback for browsers that don't support [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback); | ||
it has a good default value which we don't recommend to change. | ||
|
||
#### `agent.get({ debug?: boolean }): Promise<object>` | ||
|
||
A method of an Agent instance that gets the visitor identifier. | ||
We recommend calling it later, when you really need the identifier, to increase the chance of getting an accurate identifier. | ||
`debug: true` prints debug messages to the console. | ||
Result object fields: | ||
|
||
- `visitorId` The visitor identifier | ||
- `components` A dictionary of components that have formed the identifier. | ||
Each value is an object like `{ value: any, duration: number }` in case of success | ||
and `{ error: object, duration: number }` in case of an unexpected error during getting the component. | ||
- `version` The fingerprinting algorithm version which is equal to the library version. | ||
See [the version policy section](#version-policy) for more details. | ||
|
||
See the [extending guide](docs/extending.md) to learn how to remove and add entropy components. | ||
|
||
#### `FingerprintJS.hashComponents(components: object): string` | ||
|
||
Converts a dictionary of components (described above) into a short hash string a.k.a. a visitor identifier. | ||
Designed for [extending the library](docs/extending.md) with your own components. | ||
|
||
#### `FingerprintJS.componentsToDebugString(components: object): string` | ||
|
||
Converts a dictionary of components (described above) into human-friendly format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Version policy | ||
|
||
The documented JS API follows [Semantic Versioning](https://semver.org). | ||
Use undocumented features at your own risk. | ||
|
||
## Visitor identifier compatibility | ||
|
||
The library tries to keep visitor identifiers the same within a minor version (i.e. when the first 2 numbers of the version don't change). | ||
Some visitor identifiers may change within a minor version due to stability fixes. | ||
To get identifiers that remain stable up to 1 year, please consider [upgrading to pro](https://dashboard.fingerprintjs.com). | ||
|
||
Agent `get()` function returns the version together with the visitor identifier. | ||
You can use it to decide whether a couple of identifiers can be matched together. | ||
Example: | ||
|
||
```js | ||
if ( | ||
result1.version.split('.').slice(0, 2).join('.') === | ||
result2.version.split('.').slice(0, 2).join('.') | ||
) { | ||
return result1.visitorId === result2.visitorId ? 'same' : 'different' | ||
} else { | ||
return 'unknown' | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters