Skip to main content
The window.ef object is available on every funnel page. Use it in Client script nodes, in inline scripts, or anywhere on the page to work with tags, visibility, flow control, and timing — without loading the full funnel engine.

Tags

Add, check, or remove tags (same as Add tag / Has tag nodes).

Flow control

Advance to the next step from a client script with ef.nextNode().

Visibility

Check if an element is visible or wait until it appears.

Timing

Delay execution with ef.wait().

Video

Check video progress (seconds or %) and run a callback when the CTA is shown.

Cart

Run a callback when a product is added to the cart with ef.onAddToCart().

Where you can use it

  • Client script node — Your script runs in the page; you can call ef.addTag(), ef.nextNode(), ef.waitForVisible(), etc. The flow does not auto-advance after a client script; call ef.nextNode() when you want to continue.
  • Any inline or page scriptwindow.ef is defined early, so you can use it in onclick, in a <script> block, or from other JS.
  • Click tracking — Buttons or links with data-ef-add-tag="tagname" will add that tag when clicked (no client script needed).

Tags

Tags are stored in cookies (same as the Add tag and Has tag nodes). Use the same tag name in the builder and in ef so conditions and scripts stay in sync.

ef.addTag(name, expirationMinutes)

Sets a tag (stored in a cookie). Use after a conversion, CTA click, or in a client script.
  • name — Tag name (same as in the Add tag node and Has tag condition).
  • expirationMinutes — Optional. If omitted or 0, the tag is a session cookie (cleared when the browser closes). If set to a positive number, the tag expires after that many minutes (e.g. 60 = 1 hour, 10080 = 7 days).

ef.hasTag(name)

Returns true if the tag is set, false otherwise.

ef.removeTag(name)

Removes the tag (deletes the cookie).

Flow control

ef.nextNode()

Only meaningful inside a Client script node. Advances the funnel to the next step. You can call it immediately or later (e.g. after ef.waitForVisible or ef.wait).
In the client script you write ef.nextNode() with no arguments. The funnel engine replaces this with a call that knows the current node, so each script gets the correct “next” step.

Visibility

ef.isVisible(selectorOrElement)

Returns true if the element exists and is visible (non-zero size, not display: none, not visibility: hidden, opacity > 0). Accepts a CSS selector string or a DOM element.

ef.waitForVisible(selector, callback)

Waits until an element matching the selector is in the DOM and visible, then runs the callback once. Works on refresh if the element is already visible. Returns a cancel function so you can stop waiting.

Timing

ef.wait(ms, callback)

Runs the callback after ms milliseconds. Returns a cancel function (clears the timeout).

Video

These helpers use the same video state as the Video progress check and On CTA nodes (Vidalytics, TrackPlay, SmartPlayer, or main page video).

ef.videoProgressCheck(opts)

Returns true if the video has reached the given position, false otherwise. opts is an object with either seconds or percent (or both).
  • seconds — Target playback time in seconds (e.g. 30 = 30 seconds).
  • percent — Target percentage of video length (e.g. 50 = 50%).

ef.onCta(callback)

Runs your callback when the video CTA is shown (when video-cta-shown fires, e.g. from getStarted()). The callback receives one argument: the event detail object (e.g. { focus_on_cta, timestamp }). Returns an unsubscribe function to remove the listener.

ef.getVideoProgress()

Returns the current video state: { currentTime, duration, percent }. Same sources as the funnel video nodes. Useful when you need raw values instead of a threshold check.

Cart

ef.onAddToCart(callback)

Runs your callback whenever a product is added to the cart. It fires for the client-side cart (ef.addToCart, .ef-add-to-cart elements, and cart + / − buttons) and for /b buy links. Returns an unsubscribe function.
Post-purchase one-click upsells (/ef-u) are a separate purchase event and do not trigger this callback.
Safe to call from custom head code or a tracking script that runs before the page bundle finishes loading — early ef.onAddToCart(...) calls are queued and registered automatically once window.ef is ready.
The callback receives a single event object:
  • source'cart' or 'buy-link'.
  • products — array of { id, name, price, currency, brand, quantity }.
  • cart — full cart snapshot (client cart only; undefined for buy links).
The same payload is also dispatched as an ef:add-to-cart CustomEvent on window. This is handy for Google Tag Manager or pixels that listen for DOM events instead of calling window.ef:
onAddToCart fires only when an item is added. To react to any cart change (add, remove, quantity, clear), listen for the cart-updated window event instead — see the Cart reference.

Client script examples

Wait for an element, then continue:
Delay, then continue:
Set a tag and continue:
Branch in script (then continue when ready):

Adding a tag from a click (no script)

Add data-ef-add-tag="tagname" to a link or button (or to a parent component with data-cid). When the user clicks, the tag is set automatically. Useful for “clicked CTA” or “opened modal” without a client script.

Summary