Skip to main content
Version: 4.6.1

Initialization Option Reference

Complete reference for all NetFUNNEL JavaScript Agent configuration options (data-attributes).


Table of Contents


Required Attributes

These attributes are mandatory for the agent to function properly.

AttributeDescriptionRequired
data-nf-client-idClient identifierYes

Network Settings

Control network behavior and timeouts for NetFUNNEL server communications.

AttributeMethodRequiredDefaultRange
data-nf-network-timeoutURL-triggered, Code-basedOptional3000100–10000
data-nf-retry-countURL-triggered, Code-basedOptional00–10
data-nf-use-network-recovery-modeURL-triggered, Code-basedOptionalfalsetrue/false

Network Failure Concepts

Understanding network failures and their handling is crucial for configuring NetFUNNEL properly. The behavior differs significantly between integration methods and failure causes.

Network Failure Causes:

CauseDescriptionDetectionExamples
OfflineClient-side network disconnectionNetwork offline (detected via navigator.onLine = false)WiFi disabled, ethernet unplugged, airplane mode
DelayNetwork latency exceeding timeoutResponse time > data-nf-network-timeoutSlow connection, server overload, network congestion

Failure Classification:

Failure TypeDescriptionRetry Behavior
Transient FailureTemporary network issues (Offline/Delay)Auto-retry based on data-nf-retry-count
Permanent FailureAll retry attempts exhaustedNo more retries, triggers error handling

Error Handling by Integration Method:

Error handling occurs after all retry attempts are exhausted (permanent failure).

Request → Timeout → Transient Failure → Retry → Success OR Permanent Failure → Error Handling
Integration Method5101 (Key Issuance) FailureService Entry5002 (Entry Check) FailureService Entry
URL-triggeredNo error handling (i.e. Bypass traffic control → Target page)✅ YesNetwork Error Page (w/ Try Again button)❌ No
Code-basedNetworkError callback (w/ 1001 or 1002 statuscode) -> No waiting room modal shown❌ NoNetworkError callback (w/ 1001 or 1002 statuscode) → Close waiting room modal❌ No

data-nf-network-timeout

Maximum timeout duration for NetFUNNEL server API requests before considering them transient failures.

PropertyValue
Unitmilliseconds (ms)
Range100–10000
Default3000
Applies toNetFUNNEL server endpoints only

Behavior:

  • No response within timeout → Transient Failure
  • Immediate error response → No timeout wait
  • Each retry uses the same timeout setting

Examples:

  • data-nf-network-timeout="1000" → 1 second timeout
  • data-nf-network-timeout="5000" → 5 second timeout

data-nf-retry-count

Number of additional retry attempts for transient failures in NetFUNNEL server API calls.

PropertyValue
Range0–10
Default0
FormulaTotal attempts = (setting value) + 1
Applies toNetFUNNEL server endpoints only

Behavior:

  • Transient Failure → triggers retry (if retry count > 0)
  • Permanent Failure → all retry attempts exhausted
  • Each retry respects the data-nf-network-timeout setting

Examples:

  • data-nf-retry-count="0" → No retry (single attempt)
  • data-nf-retry-count="1" → 1 initial + 1 retry (2 total attempts)
  • data-nf-retry-count="2" → 1 initial + 2 retries (3 total attempts)
URL-triggered 5101 Exception

URL-triggered 5101 requests have no retry mechanism - any single failure becomes a permanent failure, bypassing traffic control entirely.

data-nf-use-network-recovery-mode

Prevents users from being kicked out of waiting rooms due to network issues. When enabled, users stay in their waiting state (modal or waiting room) even when network problems occur, and automatically resume when connectivity is restored.

PropertyValue
Defaultfalse
Applies to5002 (entry check) requests only
Core BenefitNo interruption to waiting experience during network issues

The Problem This Solves:

  • Without recovery mode: Network failure → Error page/callback → User loses waiting position
  • With recovery mode: Network failure → Stay in waiting → Auto-resume when network recovers

Behavior:

Mode5002 (Entry Check)User Experience
trueStay in waiting, auto-recoverNo interruption
falseNormal retry → Error handlingError page/callback

Recovery Scenarios:

  • Quick recovery: Keep existing key/sequence (maintains queue position)
  • Extended outage: Get new key/sequence (position may reset)
Queue Position Management

For guaranteed queue position preservation across long outages, use the Queue Position Management feature in NetFUNNEL Console.

Network Settings Interaction Flow

How timeout, retry count, and recovery mode work together to handle network failures.

Network Settings Behavior

How network settings work together and their combined effects across different integration methods and recovery modes.

NetFUNNEL Server API Endpoints

API EndpointPurposeAffected by Network Settings
5101 (Key Issuance)Initial request for a key and waiting decisiontimeout, retry-count
5002 (Entry Check)Periodic requests while in the waiting roomtimeout, retry-count, recovery-mode
5003 (Alive Notice)Keep key active (Section Control only)timeout, retry-count
5004 (Key Return)Return key after service completiontimeout, retry-count

Network Error Types

CodeTypeDescription
1001Network Not ConnectedNetwork is offline or unreachable
1002Network TimeoutRequest exceeded timeout limit

Scenario 1: Normal Flow (5101 Success)

Scenario 2: 5101 (Key Issuance) Network Failure (No Retry)

Scenario 3: 5002 (Entry Check) Network Failure (With Retry)

Scenario 4: Recovery Mode Enabled


Control how NetFUNNEL stores state values in the browser.

AttributeMethodRequiredDefaultOptions
data-nf-use-storage-typeURL-triggered, Code-basedOptionalbothboth, session, cookie
data-nf-custom-cookie-domainURL-triggered, Code-basedOptional(empty)Domain string

data-nf-use-storage-type

During traffic control, NetFUNNEL stores various state values—including keys—in the browser. This specifies the storage type used.

Options:

  • both: Uses both sessionStorage and cookies for maximum compatibility
  • session: Uses only sessionStorage (data lost when tab closes)
  • cookie: Uses only cookies (persists across browser sessions)

Force cookie domain for sharing cookies across subdomains.

Usage: Provide a domain string (e.g., .example.com) to share cookies across subdomains.


URL-triggered Options

Options used only with URL-triggered integration.

AttributeMethodRequiredDefaultOptions
data-nf-return-keyURL-triggeredOptionaltruetrue/false

data-nf-return-key

In the URL-triggered method, you are redirected to the NetFUNNEL waiting room and then back to the target page. This attribute controls whether to automatically return the key after entry.

Behavior:

  • true (default): Key automatically returned when returning to target page
  • false: Manual key return required (useful for custom integration scenarios)

UI & Template Options

Control waiting room appearance and templates.

AttributeMethodRequiredDefaultOptions
data-nf-use-netfunnel-templateURL-triggered, Code-basedOptionaltruetrue/false

data-nf-use-netfunnel-template

Use the default NetFUNNEL waiting room template.

Options:

  • true (default): Uses NetFUNNEL's standard waiting room template
  • false: Allows custom waiting room template implementation

Error Handling Options

Control how errors are handled and displayed to users.

AttributeMethodRequiredDefaultOptions
data-nf-error-bypassURL-triggered, Code-basedOptionalfalsetrue/false

data-nf-error-bypass

Treat Error/NetworkError as Success.

Behavior:

  • false (default): Normal error handling (callbacks/redirects on errors)
  • true: Treats errors as success, allowing service to continue (bypass mode)

Error Types Handled:

  • Network errors (1001, 1002)
  • Server errors (500)
  • User cancellation (499)
  • Invalid configuration errors

URL-triggered Integration Error Page: When data-nf-error-bypass="false" and network recovery mode is disabled, users see:

Network Error
The waiting process was interrupted due to a network error with your device or communication.

Please press the button below to try waiting again.
[Try Again Button]

Code-based Integration Callbacks: When data-nf-error-bypass="false", the following callbacks are triggered:

  • onNetworkError: For network-related errors (1001, 1002)
  • onError: For server errors (500)
  • onClose: For user cancellation (499)

Complete Example

Here's a complete initialization script with all options:

<script
src="https://agent-lib.stclab.com/agents/client/javascript/netfunnel-javascript-agent.js"
data-nf-client-id="your-client-id"
data-nf-retry-count="2"
data-nf-network-timeout="5000"
data-nf-use-network-recovery-mode="true"
data-nf-use-storage-type="both"
data-nf-custom-cookie-domain=".example.com"
data-nf-return-key="true"
data-nf-use-netfunnel-template="true"
data-nf-error-bypass="false"
></script>