Embed Sharp Signals in a page
Sharp Signals evaluates observations from a web visit
without requiring email or account creation on your site. This example collects
a token for one interaction and passes it to your own server for evaluation. fp-token.js obtains the
token through the separately served fp-probe.js file. Your page writes the
returned value into a hidden field. The served file handles the request, browser
assessment and optional WebTransport session, so Emvero can update them
independently of the small token wrapper in your bundle.
Enable Sharp Signals in your Emvero account,
wait for a ready connection and create a page key for your HTTPS origin. Keep
the separate secret API credential on your server. Replace the client code and
public page key below with your account’s values. /evaluate-visit is an example
receiver you implement in your application, not an Emvero endpoint:
<form method="post" action="/evaluate-visit"> <label>Reference <input name="reference"></label> <input type="hidden" name="fp_token"> <button>Evaluate visit</button></form>
<script src="/fp-token.js"></script><script src="https://probe.tlsatlas.com/fp-probe.js?client=your_client_code"></script><script src="https://docs.emvero.io/js/c136c4d/fp-visitor.v1.js" integrity="sha384-7Li+8gbiYvj+bI80tyd6HAxAU7HLpANkxN3OQrhJN+40ZqreHPdKD3tS1oMsKA0E" crossorigin="anonymous"></script><script> function onVisitFormShown(form) { const field = form.querySelector('input[name="fp_token"]'); if (!field || typeof FpToken !== "function") return Promise.resolve(""); const visitToken = new FpToken( "https://fp.tlsatlas.com/_fp/token", "fp_key_your_page_key", { quic: true, visitor: true } ); let submitted = false; function keep(token) { if (token && !submitted) field.value = token; return token; } const first = visitToken.fetch().then(keep); form.addEventListener("input", () => { first.then(() => { if (!submitted) return visitToken.fetch().then(keep); }); }, { once: true }); const timer = setInterval(() => { visitToken.fetch().then(keep); }, 12 * 60 * 1000); form.addEventListener("submit", () => { submitted = true; clearInterval(timer); }, { once: true }); return first; }</script>Call onVisitFormShown(form) once from your form-show handler with the form
DOM element, after applicable consent. For an initially visible form, use your
page-ready handler; for a dialog, wait until it opens. Script loading does not
itself request a token. Cancel the timer and listeners in your application when
closing or unmounting a form without submitting it. For an interaction without
a form, use the same lifecycle: start on display, retain the latest successful
token, stop collection on completion and send that token to your server.
Do not reuse one token as an unlimited monitor of later actions.
We strongly recommend Emvero’s Visitor ID generator as the standard integration.
fp-visitor.v1.js supplies the identifier when { visitor: true } is enabled,
so call fetch() without an argument. The helper uses a cookie, localStorage
and IndexedDB; load it only when your site has the required basis for that storage.
A missing helper can still leave a usable token without its Visitor ID; a missing
wrapper or incompatible probe leaves no token.
The versioned token script
Section titled “The versioned token script”| URL | https://docs.emvero.io/js/c136c4d/fp-token.js |
|---|---|
| Integrity | sha384-BscMW37DO5GnwOEP3UejPSWnRR+7WQ/KCgfpmYFEvVxWJWYgIcHgNnWIpHG+s+Yo |
| Size | 10,226 bytes |
| Revision | c136c4d9b449, copied byte for byte from Emvero’s internal token-script source |
Each release has its own URL and its bytes stay unchanged. Older releases stay
available. Download this file, check its integrity and serve it from your own
origin as /fp-token.js, as the example above assumes:
curl -sSo fp-token.js https://docs.emvero.io/js/c136c4d/fp-token.jsecho "sha384-$(openssl dgst -sha384 -binary fp-token.js | base64)"Alternatively, load that version from the documentation host:
<script src="https://docs.emvero.io/js/c136c4d/fp-token.js" integrity="sha384-BscMW37DO5GnwOEP3UejPSWnRR+7WQ/KCgfpmYFEvVxWJWYgIcHgNnWIpHG+s+Yo" crossorigin="anonymous"></script>crossorigin="anonymous" is required for a browser to check the integrity of a
script loaded from another origin. Do not edit a pinned copy and retain its old
integrity value.
The current token script is also available at
https://probe.tlsatlas.com/fp-token.js. That URL follows service updates; use
the versioned file above when you need fixed bytes and an integrity value.
The constructor and browser probe
Section titled “The constructor and browser probe”new FpToken(endpoint, key, options)| Argument | Meaning |
|---|---|
endpoint |
The token endpoint shown in your account, such as https://fp.tlsatlas.com/_fp/token. |
key |
A public page key: fp_key_ and 43 more characters. It is accepted only on its configured origins. |
options |
Optional settings below. |
| Option | Effect |
|---|---|
{ timezone: false } |
Omits the browser’s time-zone statement; the related comparisons report themselves not evaluated. |
{ probe: false } |
Disables the browser probe and its WebTransport session, even if the probe script is loaded. |
{ quic: true } |
Opts into a WebTransport session through the probe. It is off by default and needs a compatible probe and a node that supports the session. |
{ visitor: true } |
Strongly recommended: use Emvero’s Visitor ID helper, loaded before collection. The helper supplies the identifier; an argument to fetch(vid) is ignored. |
{ preconnect: false } |
Disables connection prewarming when collection runs. |
Load fp-probe.js?client=… with your public client code. Do not substitute the
page key for that code. Its current interface is window.FpProbe with API
contract 3; FpToken.fetch() delegates to its token() method. The file is
required even with { probe: false }: that option skips browser assessment,
while the served file still performs the token request.
Keep the probe on its service URL without integrity so its build can update independently. Load fp-visitor.v1.js from the versioned documentation URL in the example above: its bytes match the pinned SRI hash. The unversioned service URL can serve different bytes, so do not pair it with that hash. A remotely served fp-token.js can also use SRI, but its hash must follow any file change; the versioned documentation URL and a local copy keep fixed bytes.
A missing or incompatible probe file leaves no token. Individual browser checks
can remain not evaluated while a usable token is obtained; in that case the
operation can remain evaluated and include fp_probe_not_evaluated.
In the signup policy, automation findings can require email confirmation; property-tampering findings do
not raise by default but count toward the visit’s risk. See the
signal-code reference.
Start when the form is shown
Section titled “Start when the form is shown”Create the FpToken instance with { visitor: true } and call fetch() when the person can see the
form or other observed interaction, after applicable consent. For a form visible from the start, initialise
when the page is ready; for a dialog, wait until it opens. Calling it only on submission can
produce fp_fast_submission.
That timing rule was designed for signup forms. An immediate page-load
evaluation can be fast by design; do not treat this fact alone as abuse for
a different application action.
From script loading, the probe listens for mouse movement and keeps counters in page memory. Each token request seals the observations available at that moment. The first token usually precedes mouse movement, so refresh once on the first input after the initial request finishes, as in the example. Mouse observations are unavailable on touch-only visits; this alone does not establish automation.
The token script makes no request before fetch(). A remotely loaded script
tag still downloads its file before that call. If your consent flow must defer
those downloads too, insert the script tags only after consent.
The method’s contract is:
fetch(vid?: string | PromiseLike<string>): Promise<string>The return value is always a Promise. It resolves to the token string on success
or to '' if no token was obtained. Your page writes that value into its field.
The token wrapper and probe use no browser storage. The recommended, separate Visitor ID helper uses a cookie, localStorage and IndexedDB. Neither collection nor refresh should block form submission. On submission, use the latest successfully obtained token and do not call fetch(). A changed IP can restart timing during refresh, so collecting on submission can make a normal form appear unusually fast.
Refresh a token on a long form
Section titled “Refresh a token on a long form”A token lives for 15 minutes in the current profile. The complete example
refreshes every 12 minutes and stops its timer on submission. A failed refresh
returns ''; preserve the previous token instead of clearing the hidden field.
That previous token is still subject to expiry on the server. Submission uses
the latest token already obtained, without waiting for a pending request.
Do not wrap collection in a shorter timeout: allow up to 2.1 seconds for the probe on a busy thread, plus the token request; with a Visitor ID promise, allow up to 3 seconds plus the request. These limits do not bound network time.
A repeated fetch() uses a live token kept by the served probe in page memory.
The node preserves the first issue time only if the previous token is usable,
the IPv4 address or IPv6 /64 is unchanged, the browser family, major version
and platform match, and the visit is no older than 24 hours. Otherwise the
timing starts again; a submission soon afterwards can produce the
fast-submission finding. Schedule the call before expiry and update the field
only when the result is non-empty.
Under the signup policy, an expired token can require email confirmation; refresh after expiry cannot be relied
on to preserve an earlier visit interval. The wrapper has no timers of its own.
Use Emvero’s Visitor ID generator
Section titled “Use Emvero’s Visitor ID generator”We strongly recommend fp-visitor.v1.js with { visitor: true } over generating
your own Visitor ID. The node issues an identifier bound to your client and
verifies its signature, key and expiry. The visitor note can report new,
replaced or returning_lt1d, returning_1_6d, returning_7_29d,
returning_30d_plus. These buckets measure age since issuance, not time since
the last visit. Returning does not prove a unique person or lower the action.
The helper stores the issued identifier in __Host-fp_visitor, localStorage
and IndexedDB on your site. Its cookie has Secure; SameSite=Lax; Path=/ and
an upper lifetime of 400 days, subject to browser limits. Local storage and
IndexedDB copies have no automatic storage expiry and remain until cleared or
replaced; the node separately checks identifier expiry. If storage permission
is withdrawn, stop collection and call FpVisitor.forget() to clear the helper’s
copies. You can also download the versioned helper
and serve it locally with the same integrity value.
Alternative: supply your own identifier
Section titled “Alternative: supply your own identifier”If your application must use its own generator, omit visitor: true and pass
an opaque string or Promise to fetch(vid). Do not embed an account or user ID,
email address or phone number. The raw value can enter the token request query.
A customer-generated ID is reported as external, without a verified issuance
age. A later fetch() keeps the page identifier, fetch(vid) replaces it and
fetch('') removes it. An unavailable or late Promise is omitted.
With { visitor: true }, the helper supplies the ID and an argument to
fetch(vid) is ignored. Neither integration adds a vid field to Emvero’s
public checking API: send the token unchanged. When a token carries an ID,
Emvero’s separate fp_visitor_repeat
finding counts earlier checks with that ID on your account within 30 days.
This count and the visitor age note are different observations; neither is
identity detection across sites or accounts.
What leaves the browser
Section titled “What leaves the browser”With a compatible served file, fetch() initiates a cross-origin GET for a token,
with credentials: 'omit' and cache: 'no-store'. Its query can contain the
page key, browser time zone, previous token, Emvero-issued or customer-supplied vid, probe
result and WebTransport receipt. No custom headers or CORS preflight are used.
With { quic: true } and a compatible probe, collection also attempts a
WebTransport session. Its failure does not prevent the TCP token request.
Current opaque tokens use format v14; forward the value without decoding it.
The internal processing runs within Emvero’s EU infrastructure; the website’s
privacy policy explains data and retention.
Content-Security-Policy
Section titled “Content-Security-Policy”For the example with a locally served token script, a versioned Visitor ID helper and a remotely served probe:
Content-Security-Policy: default-src 'self'; script-src 'self' https://docs.emvero.io https://probe.tlsatlas.com 'wasm-unsafe-eval'; worker-src 'self' blob:; connect-src 'self' https://fp.tlsatlas.comThe helper needs https://docs.emvero.io in script-src. The probe needs its
own script host, 'wasm-unsafe-eval' for WebAssembly and worker-src blob: for
its Worker checks. The token endpoint belongs in connect-src. The same
documentation host also serves the pinned token script if you load it remotely.
Put the initialisation in your own script file, or authorise the inline block with a nonce or hash. A blocked probe script prevents token collection. Restrictions on individual Worker or WebAssembly checks can leave those comparisons incomplete; inspect the returned assessment limits. A WebTransport attempt uses the capture node’s origin.
Page keys and origins
Section titled “Page keys and origins”The account area accepts up to 20 origins per key and 20 live keys per account.
An origin can be an exact HTTPS origin, including a port, or a subdomain zone
such as https://*.example.com. Paths, queries, HTTP, a bare * and
https://*.com are refused. Hostnames are normalised to lowercase and IDN to
Punycode.
A revoked key cannot be restored. Key changes take effect after synchronisation; a ready connection is separate from a working integration. Complete a real server check and read its result as described in the standalone Sharp Signals guide. For a combined registration request, continue with the signup protection scenario.
Check the browser integration
Section titled “Check the browser integration”In DevTools, confirm that the three script files load and FpProbe.api is at
least 3. Form display starts a token request; the first input starts one refresh
after it, with t carrying the previous token. An ordinary token request is one
GET without custom headers or preflight. With quic: true, it also attempts a
WebTransport session. A missing receipt can reflect browser or network limits,
rather than an installation error. If the request lacks p, check WebAssembly
CSP and probe: false; if no request appears, first check the probe script and
its API contract. Test a failed refresh and submission while refresh is pending:
the field must keep the latest token, and submission must proceed immediately.