index.js) and Forms SDK (sdk-core.js).
Read Understand the Pixel and Forms SDK first to learn how the
Pixel and Forms SDK work together.
Everything on this page comes from the script’s own source. We call out anything we could not confirm.
Entry points
Both scripts read scheduler configuration from the same block and post to 1 shared scheduler event
bus.
on(), scheduler.*, and submitForm() therefore behave the same from either script.
See Methods below for exactly which methods live on which global.
Configuration
Shared configuration options
Set these options aswindow.__defaultPixel__, or pass them to DefaultPixelSDK.init(options) with
the same shape. The init() path is useful when the key is only known at runtime.
The SDK reads window.__defaultPixel__ automatically on load. A later init() call updates the
configuration in place.
The SDK applies setConsent calls queued on the generated Pixel loader, so a choice your banner
made before the SDK loaded still counts. See Install the Forms SDK.
sdk.js, the earlier Forms SDK file, still works with the same API. It also runs visitor
fingerprinting and session tracking, and it applies queued setConsent calls before it starts
tracking. When it shares a page with the Pixel, either script can load first, and a later
window.__defaultPixel__.setConsent call reaches both. To move to sdk-core.js, change only the
script address.
The Pixel (index.js) has no init() to call, but it reads key, formsEndpoint, schedulerOrigins,
autoDisplayScheduler, and schedulerHandoffVerifyKey directly off the same window.__defaultPixel__
block. Only endpoint is SDK-only.
index.js) has no equivalent init() call. Its tracking requests use Default’s standard
endpoint. Set window.__defaultPixel__.formsEndpoint before loading the script to send form requests
through a separate proxy, such as when the tracking host is blocked. The proxy must forward the
existing form routes, including /api/pixel/*; changing the host does not rename those paths.
It also reads schedulerOrigins and autoDisplayScheduler off window.__defaultPixel__. See the table
above.
Automatically detected forms, which involve no submitForm() call, read only the { target, loader }
shape of autoDisplayScheduler. The true and false values do not apply there, because the calendar
always displays somewhere on a handoff.
When target is set for an automatically detected form, the loading indicator defaults to shown. Set
loader: false there to hide it.
This default is the opposite of submitForm()’s. See
The scheduler experience in the guide for what
this means in practice.
Methods
on, submitForm, and scheduler.* are on both window.DefaultPixel and window.DefaultPixelSDK.
init, recordFormInteraction, and setConsent are on window.DefaultPixelSDK only.
init
DefaultPixelSDK.init(options). This method exists only on window.DefaultPixelSDK, and the Pixel
(index.js) has no equivalent call.
Every call configures the SDK, and the first call also starts it. The start attaches the email-blur
listener that powers pre-enrichment. The Forms SDK does no identity or session tracking of its own; see
What gets captured automatically.
The start also checks for a pending scheduler handoff left over from a same-page redirect. The method
returns nothing.
See Shared configuration options above for options.
The SDK also calls this automatically on script load if window.__defaultPixel__.key is present. Most
integrations never call it directly.
on
DefaultPixelSDK.on(eventType, handler).
Subscribes to a raw scheduler event. Returns an unsubscribe function.
eventType is one of the 5 values in Scheduler events below. Most integrations
use the typed helpers under scheduler.* instead.
The helpers are equivalent, but they save you from typing the event name as a string.
submitForm
DefaultPixelSDK.submitForm(options). You can also call it as DefaultPixel.submitForm(options) on
the Pixel bundle, but most integrations only need it via the SDK (see Entry points).
It submits a set of field values directly to a known Pixel form, without going through form detection.
It returns a promise, never throws on a failed request, and resolves with success: false instead.
success: true means the request completed. It does not prove a submission was saved or a workflow
ran. A form with submissions disabled, or a page outside its allowed paths, can return success.
Read submission and workflowOutcome to see whether Default accepted the submission and whether
it started a workflow. accepted confirms the server accepted the submission for processing. The API normally waits for event publication. When it returns a scheduler or redirect handoff,
or reaches the realtime workflow wait deadline, publication can finish in the background. Downstream processing and visibility can lag either response. Check Recent Submissions to confirm a
submission was recorded. Against an older API submission and workflowOutcome are absent, so check
Recent Submissions and the workflow’s result there too.
When multiple
<form> elements are on the page, and you call submitForm({ pixelFormId, ... })
without also passing formId, the SDK guesses which DOM form you mean. The guess only enriches the
submission with the form’s name, action, and class, and it never changes what gets submitted.
The SDK picks the currently focused field’s form. If there is more than 1 form on the page, it picks
a form tagged with a matching data-pixel-form-id or data-form-id attribute.
To remove the ambiguity, pass formId explicitly or add one of those attributes.
Your workspace’s form editor includes a live version of this call, pre-filled with your real public
key, form id, and field names. To find it, open Forms, select a form, then open its Install tab,
section Use the SDK.
See Manual submission (the SDK) in the guide
for how that sample relates to the initialization-timing guidance on this page.
recordFormInteraction
DefaultPixelSDK.recordFormInteraction(options). This method exists only on window.DefaultPixelSDK,
and the Pixel (index.js) has no equivalent call.
It manually mirrors the automatic email-blur warmup that powers pre-enrichment. Use it on hosts where
the fields are not inside a native <form> element, so the SDK’s own listener has nothing to attach to.
It never throws and swallows failures. The warmup is best-effort, not a required call.
pixelFormId to both methods. If the form also has an HTML ID, pass the
same formId in both calls so either identifier can connect the warmup to the submission:
setConsent
DefaultPixelSDK.setConsent(consent). This method exists only on window.DefaultPixelSDK, and the Pixel
(index.js) has no equivalent call. On the Pixel, use window.__defaultPixel__.setConsent instead.
consent is Partial<{ analytics: boolean; marketing: boolean }>. Pass only the categories that
changed; a category you leave out keeps its saved value, or allowed if the visitor never chose.
The choice is saved in the _dflt_consent cookie, so it applies to later pages and to the Pixel.
Withholding analytics also drops the identifiers the SDK stored in the tab. The Forms SDK loads no
Vector script, so marketing is saved but changes nothing in it. The method returns nothing.
setConsent call your banner made through window.__defaultPixel__.setConsent before the SDK
loaded is applied for you. See Shared configuration options.
scheduler
DefaultPixelSDK.scheduler. A small object of typed helpers, all built on on() above.
Each
onX helper returns an unsubscribe function, same as on().
Scheduler events
Bothon() and scheduler.onX react to messages that the embedded calendar posts. You can subscribe
from either window.DefaultPixel or window.DefaultPixelSDK, because the 2 scripts share 1 event
bus.
Default validates each event against schedulerOrigins before your handler runs. It drops anything from
an origin outside that list.
What gets captured automatically
Whether a submission comes from automatic detection orsubmitForm(), Default fills in the same
context fields for you:
The visitor and session ids depend on which script sent the submission. With analytics denied,
neither script saves a visitor identifier.
Server contract (SDK submissions)
submitForm() posts to the same submission endpoint as automatically detected forms. Default tags the
request so it can tell the 2 apart:
- The request includes the Pixel form id when you passed
pixelFormId. It also includes a marker that the submission came from the SDK rather than automatic detection. - An explicit
pixelFormIdmust name an active form in the workspace tied to your public key. Otherwise the request fails with a 404. Matching by HTMLformIdis limited to the page’s domain. - Default only saves accepted submissions from allowed pages. Published workflows attached to that form can then run.
Troubleshooting
See Troubleshooting in the integration guide for symptom-to-fix guidance, including the scheduler-latency issue this reference doesn’t repeat here.Related guides
Set up the Pixel and Forms SDK
Connect a domain, add a form, install the SDK, and verify a workflow.
Build a reliable Forms SDK flow
Apply the recommended initialization, submission, and scheduler pattern.
Understand the full integration
Learn how identity, form capture, workflows, and scheduler handoffs work together.