@ebitex/visitors-sdk
v0.1.347
Published
Recognise a returning visitor with their consent, honour Global Privacy Control and your own consent tool, and let them forget their device, from any site. No forms needed.
Downloads
469
Maintainers
Readme
@ebitex/visitors-sdk
Recognise a returning visitor with their consent, honour Global Privacy Control and your own consent tool, and let them forget their device, from any site. You do not need forms, or any other ebitex product beyond Audience.
- Zero runtime dependencies. Works with a plain
<script>tag, with a bundler, and with React. - The visitor's token is kept in a first-party cookie only while ebitex says that device may be recognised, and removed when recognition is denied, withdrawn, or the device is forgotten.
- "Forget this device" is one operation with several doors: a footer link, a function, a React button, or a plain request from your own server.
interaction('pricing-viewed', { ... })puts an interaction on the timeline of the person a recognised device belongs to. It is not a page-view tracker: nothing is stored for an anonymous visitor.event({ kind: 'content.viewed', subject: { categories } })records a high-volume event, such as a page viewed, that audiences count ("viewed three pages about espresso this week"). An event is not an interaction: it appears on nobody's timeline and is kept only briefly.pageViewed({ categories })is the shorthand, and the drop-in script can record a view on load when you adddata-ebitex-page-viewsand a<meta name="ebitex:categories" content="id,id">tag (off unless you ask). Nothing is stored for an anonymous visitor.
Install
npm install @ebitex/visitors-sdkOr, on a page with no build step:
<script type="module"
src="https://cdn.jsdelivr.net/npm/@ebitex/visitors-sdk@0/dist/script.js"
data-ebitex-key="ebx_your_browser_key"></script>
<footer><a href="#" data-ebitex-forget>Forget this device</a></footer>Quick start
import { createVisitors } from '@ebitex/visitors-sdk'
const visitors = createVisitors({ key: 'ebx_your_browser_key' })
const { consent } = await visitors.refresh()You need an Audience delivery key that is restricted to your site's origins (Audience, Connections, Delivery keys). The key is visible to anyone who views your page, which is safe only because of that restriction. Never put an unrestricted key in a page.
Full guide: https://developers.ebitex.io/getting-started/visitors/
Entry points
| Import | For |
|---|---|
| @ebitex/visitors-sdk | createVisitors, cookieStorage, the types |
| @ebitex/visitors-sdk/react | VisitorsProvider, useVisitors, ForgetDeviceButton (React is an optional peer) |
| @ebitex/visitors-sdk/script | The drop-in script for pages with no build step |
Licence
Apache-2.0
