Write an adapter
An adapter sends the events of a vendor tool on your page, for example a chat or a form tool. Use this page when QuickPipe has no adapter for your tool. For a cookie banner, refer to Write a consent adapter.
Built-in adapters
The script loads these adapters automatically when the vendor is on the page:
| Adapter | Example events |
|---|---|
HubSpot forms in a frame | hubspot.form_submitted |
Typeform | typeform.form_submitted |
Calendly | calendly.event_scheduled |
Cal.com | calcom.booking_created |
Pipedrive | pipedrive.form_submitted |
Intercom | intercom.conversation_started |
Cookiebot, CookieYes, OneTrust | Consent only |
A form that the page shows needs no adapter: the core sends form.submitted for it. Refer to Capture forms for the forms in a frame.
The core loads the file of an adapter only when its vendor is on the page. The browser checks the SRI hash of the file. An adapter identifies a person only from values that the vendor gives.
Procedure
Write an object of the type
Adapter:tsimport type { Adapter } from '@quickpipeaiab/lead-scoring/adapters'; export const quoteTool: Adapter = { name: 'quotetool', detect: (win) => 'QuoteTool' in win, start(ctx) { const onQuote = (event: Event) => { const { email, total } = (event as CustomEvent<{ email: string; total: number }>).detail; ctx.identify({ email }); ctx.track('quotetool.quote_created', { total }); }; window.addEventListener('quotetool:quote', onQuote); return () => window.removeEventListener('quotetool:quote', onQuote); }, };Add the adapter to the client:
tslg.use(quoteTool);
Result
The client calls detect. When detect returns true, the client calls start. The client calls the returned function when it stops.
The Context
| Member | Function |
|---|---|
track | Sends an event. Use the name form {vendor}.{action}. |
identify | Adds identifiers to the visitor |
account | Links the visitor to a company |
set | Sets attributes of the visitor |
consent | Sets the consent state of a purpose. Only a consent adapter calls it. |
config | The values of the data-<adapter name>-* attributes of the script tag |
log | Writes a message in debug mode |
Stop adapters
- To stop all adapters, set
data-adapters="off"on the script tag. - To stop some adapters, set a list with a minus sign before each name, for example
data-adapters="-typeform,-intercom".