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; callef.nextNode()when you want to continue. - Any inline or page script —
window.efis defined early, so you can use it inonclick, 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 inef 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)
Returnstrue 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. afteref.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)
Returnstrue 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 afterms 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)
Returnstrue 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 (whenvideo-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.- source —
'cart'or'buy-link'. - products — array of
{ id, name, price, currency, brand, quantity }. - cart — full cart snapshot (client cart only;
undefinedfor buy links).
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:Adding a tag from a click (no script)
Adddata-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
| Method | Description |
|---|---|
ef.addTag(name, expirationMinutes?) | Set a tag. Omit or use 0 for session cookie; use a positive number for expiration in minutes. |
ef.hasTag(name) | Returns whether the tag is set. |
ef.removeTag(name) | Remove the tag. |
ef.nextNode() | Advance to the next step (use inside Client script). |
ef.isVisible(selectorOrElement) | Returns true if the element is visible. |
ef.waitForVisible(selector, callback) | Run callback when the element is visible; returns cancel. |
ef.wait(ms, callback) | Run callback after ms milliseconds; returns cancel. |
ef.videoProgressCheck(opts) | Returns true if video reached opts.seconds and/or opts.percent. |
ef.onCta(callback) | Run callback when video CTA is shown; returns unsubscribe. |
ef.getVideoProgress() | Returns { currentTime, duration, percent } for the main video. |
ef.onAddToCart(callback) | Run callback when a product is added to the cart (client cart or /b buy links); returns unsubscribe. Also dispatches an ef:add-to-cart window event. |