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.

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).
// Session cookie (cleared when browser closes)
ef.addTag('saw_popup');
ef.addTag('newsletter_signup');

// Expires after 60 minutes (1 hour)
ef.addTag('saw_popup', 60);

// Expires after 7 days (10080 minutes)
ef.addTag('campaign_click', 10080);

ef.hasTag(name)

Returns true if the tag is set, false otherwise.
if (ef.hasTag('saw_popup')) {
  // Already saw the popup, skip
} else {
  // Show popup, then ef.addTag('saw_popup')
}

ef.removeTag(name)

Removes the tag (deletes the cookie).
ef.removeTag('saw_popup');

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.
// Continue right away
ef.nextNode();
// Continue after something is visible
ef.waitForVisible('.thank-you-message', function() {
  ef.nextNode();
});
// Continue after a delay
ef.wait(2000, function() {
  ef.nextNode();
});

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.
if (ef.isVisible('.banner')) {
  // Banner is on screen
}

var el = document.querySelector('#my-div');
if (ef.isVisible(el)) {
  // Element is visible
}

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.
ef.waitForVisible('.thank-you-message', function() {
  ef.nextNode();
});
// Optional: cancel if needed
var cancel = ef.waitForVisible('.popup', function() {
  ef.nextNode();
});
// cancel(); // to stop waiting

Timing

ef.wait(ms, callback)

Runs the callback after ms milliseconds. Returns a cancel function (clears the timeout).
ef.wait(3000, function() {
  ef.nextNode();
});
var cancel = ef.wait(5000, function() {
  doSomething();
});
// cancel(); // to clear the timeout

Client script examples

Wait for an element, then continue:
ef.waitForVisible('.order-confirmation', function() {
  ef.nextNode();
});
Delay, then continue:
ef.wait(2000, function() {
  ef.nextNode();
});
Set a tag and continue:
ef.addTag('completed_survey');
ef.nextNode();
Branch in script (then continue when ready):
if (ef.hasTag('saw_offer')) {
  ef.nextNode(); // go to next step
} else {
  ef.addTag('saw_offer');
  ef.waitForVisible('#offer-cta', function() {
    ef.nextNode();
  });
}

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.
<button data-ef-add-tag="clicked_cta">Get started</button>

Summary

MethodDescription
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.