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.| Parameter | Type | Required | Description |
|---|---|---|---|
offer_id | integer | Conditional | The offer identifier — required to record a new click (direct linking) |
affiliate_id | integer | Conditional | Required to record a new click — unless the affiliate is supplied by a coupon_code, or an existing click is matched via transaction_id |
uid | integer | No | Offer URL ID (extra destination URL) |
creative_id | integer | No | Creative identifier |
sub1 – sub10 | string | No | Affiliate sub-placement tracking values |
adv1 – adv10 | string | No | Advertiser sub-parameter values |
source_id | string | No | Traffic source identifier |
coupon_code | string | Conditional | A coupon code — records a click attributed via the coupon’s offer and affiliate |
cost | number | No | Media-buying cost to attribute to this click |
fbclid | string | No | Facebook click ID (auto-detected from the URL if omitted) |
gclid | string | No | Google click ID (auto-detected from the URL if omitted) |
ttclid | string | No | TikTok click ID (auto-detected from the URL if omitted) |
sccid | string | No | Snapchat click ID (auto-detected from the URL if omitted) |
transaction_id | string | Conditional | A 32-character transaction ID — matches an existing click instead of creating one (ITP workaround) |
tracking_domain | string | No | Tracking domain override (for multi-tenant setups — see Configuration) |
parameters | object | No | Free-form custom key–value parameters |
do_not_track | boolean | No | When 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_idand 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_idafter a redirect tracking link). The SDK matches the click that already exists and reinforces its first-party cookie;offer_idandaffiliate_idare 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 requiresoffer_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.EF.click() accepts. In practice you only pass the ones relevant to your setup — optional fields with a null/undefined value are omitted automatically.
ITP Workaround and First-Party Cookie Tracking
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, fireEF.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:
transaction_id and enhances attribution without creating a duplicate click.
Advanced Usage
Preventing duplicate clicks
UseEF.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 containoffer_id or affiliate_id parameters, you can supply default values rather than letting the click fail:
Multi-tenant attribution (multiple Everflow accounts)
When multiple Everflow accounts fire clicks on the same page, passtracking_domain per call to route each click to the correct account. See Multi-account tracking for the full pattern and caveats.