Skip to main content

Core Methods

init(config?)

Initialize the SDK (optional — auto-initializes by default).
The domain option is used by both trackConversion() and trackLead(). Per-call domain overrides take precedence over this config value.

trackConversion(options)

Track a conversion event.
Returns: Promise<boolean>

trackLead(options)

Track a lead form submission. name and phone are required; email and all other fields are optional.
Returns: Promise<boolean>

getClickId()

Get the currently stored click ID. Returns string | null.

setClickId(clickId)

Manually set the click ID.

hasTrackedConversion(event?)

Check if a conversion has been tracked. Returns boolean.

setDebug(enabled)

Enable/disable debug logging.

clear()

Clear all stored data (click ID, dedup flags).

destroy()

Fully reset the SDK. Call init() again to reinitialize.

getConfig()

Get current configuration. Returns AdscrushConfig | null.

Configuration Options


TypeScript

Full TypeScript definitions included: