Skip to main content
Version: 4.6.2-saas

Common Integration Questions

Q. How should I handle NetworkError?

A. Notify the user and either retry or proceed with original logic:

Web Javascript Integration

function handleNetworkError(response) {
if (confirm('Network error occurred. Retry?')) {
nfStart(keys, callback); // Retry
} else {
performOriginalLogic(); // Proceed
}
}

Android Integration

private val callback = object : NetfunnelCallback() {
override fun onNetworkError(statusCode: Int, message: String) {
when (statusCode) {
1001 -> {
// Network not connected
showNetworkErrorDialog()
}
1002 -> {
// Network timeout - retry
retryWithDelay()
}
}
}
}

private fun retryWithDelay() {
Handler(Looper.getMainLooper()).postDelayed({
Netfunnel.nfStart(projectKey, segmentKey, callback, this)
}, 2000)
}

Q. What if I forget to return the key?

A. The key may be auto-returned by server timeout, but this can cause bottlenecks. Always return explicitly:

Web Javascript Integration

// Recommended: Always return key
nfStart(keys, function(response) {
if (response.status === 'Success') {
performAction()
.then(() => nfStop(keys))
.catch(() => nfStop(keys)); // Return even on error
}
});

Android Integration

// Recommended: Always return key
private val callback = object : NetfunnelCallback() {
override fun onSuccess(statusCode: Int, message: String) {
performAction()
.onSuccess {
Netfunnel.nfStop(projectKey, segmentKey, completeCallback)
}
.onFailure {
Netfunnel.nfStop(projectKey, segmentKey, completeCallback) // Return even on error
}
}
}

Q. How do I debug NetFUNNEL integration?

A. Enable logging and check the console:

Web Javascript Integration

<script
src="https://agent-lib.stclab.com/agents/client/javascript/netfunnel-javascript-agent.js"
data-nf-client-id="your-client-id"
data-nf-print-log="true"
></script>

Then check DevTools Console for NetFUNNEL log messages.

Android Integration

Netfunnel.initialize(
clientId = "{{CLIENT_ID}}",
printLog = true // Enable logging
)

Then check Logcat for NetFUNNEL log messages.

Q. Can I use both URL-triggered and code-based methods?

A. Yes, you can use both methods together within a single service:

  • Use URL triggers for page-entry speed control
  • Use code-based for business concurrency control
// URL trigger for landing page protection
// (configured in console)

// Basic Control for login
function handleLogin() {
Netfunnel.nfStart("login_project", "login_segment", loginCallback);
}

// Section Control for checkout
function startCheckout() {
Netfunnel.nfStartSection("checkout_project", "checkout_segment", checkoutCallback);
}

Common patterns:

  • Use URL trigger integration for page entry protection
  • Use Basic Control (code-based integration) for entry points (login, main features) - quick key return after screen loads
  • Use Section Control (code-based integration) for important processes (checkout, payment processing) - keep key until entire process completes

However, to reduce operational complexity, it's recommended to prioritize one method.

Q. Can I use both Basic Control and Section Control in the same app?

A. Yes, you can use both methods in the same application:

iOS

// Basic Control for login
func handleLogin() {
Netfunnel.shared.nfStart(projectKey: "login_project", segmentKey: "login_segment")
}

// Section Control for checkout
func startCheckout() {
Netfunnel.shared.nfStartSection(projectKey: "checkout_project", segmentKey: "checkout_segment")
}

Common patterns:

  • Use Basic Control (code-based integration) for entry points (login, main features) - quick key return after view controller loads
  • Use Section Control (code-based integration) for important processes (checkout, payment) - keep key until entire process completes

Android

// Basic Control for login
fun handleLogin() {
Netfunnel.nfStart("login_project", "login_segment", loginCallback, this)
}

// Section Control for checkout
fun startCheckout() {
Netfunnel.nfStartSection("checkout_project", "checkout_segment", checkoutCallback, this)
}

Common patterns:

  • Use Basic Control (code-based integration) for entry points (login, main features) - quick key return after Activity loads
  • Use Section Control (code-based integration) for important processes (checkout, payment) - keep key until entire process completes

Q. Can I initialize NetFUNNEL multiple times?

A. No, NetFUNNEL should be initialized only once in your Application class. Multiple initializations may cause unexpected behavior.