Skip to main content
The EF.click() method records a click event and returns a Promise that resolves with the transaction ID. This transaction ID can then be used for conversion attribution.

Basic Usage

Parameters

Which fields are required depends on how the click is identified — see How a click is identified below. All other fields are optional.
ParameterTypeRequiredDescription
offer_idintegerConditionalThe offer identifier — required to record a new click (direct linking)
affiliate_idintegerConditionalRequired to record a new click — unless the affiliate is supplied by a coupon_code, or an existing click is matched via transaction_id
uidintegerNoOffer URL ID (extra destination URL)
creative_idintegerNoCreative identifier
sub1sub10stringNoAffiliate sub-placement tracking values
adv1adv10stringNoAdvertiser sub-parameter values
source_idstringNoTraffic source identifier
coupon_codestringConditionalA coupon code — records a click attributed via the coupon’s offer and affiliate
costnumberNoMedia-buying cost to attribute to this click
fbclidstringNoFacebook click ID (auto-detected from the URL if omitted)
gclidstringNoGoogle click ID (auto-detected from the URL if omitted)
ttclidstringNoTikTok click ID (auto-detected from the URL if omitted)
sccidstringNoSnapchat click ID (auto-detected from the URL if omitted)
transaction_idstringConditionalA 32-character transaction ID — matches an existing click instead of creating one (ITP workaround)
tracking_domainstringNoTracking domain override (for multi-tenant setups — see Configuration)
parametersobjectNoFree-form custom key–value parameters
do_not_trackbooleanNoWhen true, the call resolves immediately without recording a click

How a click is identified

EF.click() resolves to one of three behaviors depending on which identifier you pass. Provide the fields for the mode you need:
  • New click (direct linking) — requires both offer_id and an affiliate identity (affiliate_id). If either is missing, the server records the click with an error code and returns no transaction ID — the promise resolves with an empty string. This is what most recipes do.
  • Existing click (ITP workaround) — pass a valid 32-character transaction_id (typically read from _ef_transaction_id after a redirect tracking link). The SDK matches the click that already exists and reinforces its first-party cookie; offer_id and affiliate_id are not needed and are ignored in this mode. If the ID is missing, malformed, or not found, the call falls back to recording a new click — which then requires offer_id.
  • Coupon attribution — pass coupon_code; the offer and affiliate are resolved from the coupon assignment.
The 32-character length matters: a transaction_id that isn’t exactly 32 characters is treated as absent, and the call falls through to new-click behavior.
Coupon code takes precedence. If a valid coupon_code arrives alongside offer_id and affiliate_id, the click is attributed to the coupon’s offer and affiliate — not the passed affiliate_id. Only send a coupon_code when you intend coupon-based attribution.

Return Value

EF.click() returns a Promise that resolves with the transaction ID:
The promise always resolves and never rejects. On success it resolves with the 32-character transaction ID; when nothing could be tracked — do_not_track, no valid identifier, or a server/validation error — it resolves with an empty string instead. This is why patterns that chain off the result (cross-site link decoration, the EF-to-EF chain) test if (transactionId) and supply a fallback rather than relying on .catch().

Examples

With sub-placements and URL parameters:
EF.urlParameter() returns null when the parameter is not present in the URL. The SDK skips any optional field whose value is null or undefined, so a missing URL parameter is simply omitted from the click rather than sent as an empty value.
Parameters after a # in the URL are not readable. EF.urlParameter() reads from the URL’s query string (?…), so anything in the fragment — e.g. https://example.com/#/path?oid=1&affid=2 — is invisible to it, and the click will be missing those values. This is common with hash-routed single-page apps. If your parameters live after the #, move them before it, or read them from window.location.href directly instead of EF.urlParameter().
With custom parameters:
All parameters: A reference call listing every parameter EF.click() accepts. In practice you only pass the ones relevant to your setup — optional fields with a null/undefined value are omitted automatically.
You can combine the SDK with traditional redirect tracking links to enhance attribution on browsers that restrict third-party cookies (Safari ITP, etc.). When a user lands on your owned landing page after going through a redirect link, fire EF.click() with the transaction_id extracted from the URL — the SDK will set a first-party cookie on your landing-page domain, making subsequent conversion attribution more reliable. Configure your tracking link’s destination URL to include the transaction_id, offer_id, and affiliate_id macros. For a destination URL like:
fire the SDK click with the extracted values:
The SDK recognizes the existing transaction_id and enhances attribution without creating a duplicate click.

Advanced Usage

Preventing duplicate clicks

Use EF.getTransactionId() to check whether a transaction already exists for the offer before firing a new click — useful when the same page may be loaded multiple times for a returning user:

Falling back to default values

When the URL may not always contain offer_id or affiliate_id parameters, you can supply default values rather than letting the click fail:
For fleet-wide organic fallback (applied automatically to every SDK call on the page), use EF.configure({ organic: {...} }) instead of per-call defaults.

Multi-tenant attribution (multiple Everflow accounts)

When multiple Everflow accounts fire clicks on the same page, pass tracking_domain per call to route each click to the correct account. See Multi-account tracking for the full pattern and caveats.