You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56Lines changed: 56 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,62 @@ $vwoClient = VWO::init([
209
209
210
210
Refer to the [Gateway Documentation](https://developers.vwo.com/v2/docs/gateway-service) for further details.
211
211
212
+
### Synchronous network calls
213
+
214
+
Synchronous network calls differ from the default (asynchronous or fire-and-forget) tracking behavior by waiting for the tracking request to return a response from the VWO server before proceeding with the rest of your application code. By default, the SDK sends tracking network calls in a way that does not block your application, providing maximum throughput and lowest latency for user actions.
215
+
216
+
**Why is it so?**
217
+
- The default asynchronous approach ensures minimal impact on user experience or application response times. Tracking calls are dispatched without waiting for a server response.
218
+
- With synchronous calls enabled (`shouldWaitForTrackingCalls => true`), your code will block and wait for the network call to complete, allowing you to detect network errors, retry, and ensure delivery before execution continues.
219
+
220
+
**When should you use synchronous calls?**
221
+
- Use synchronous tracking when tracking data integrity or acknowledgment is critical before user flow continues (e.g., checkout flows, conversion confirmations, or compliance events).
222
+
- It is recommended when you need to guarantee that server-side events are delivered, and are willing to trade a slight increase in user-facing latency for this assurance.
223
+
224
+
225
+
226
+
You can opt-in to perform network calls synchronously by passing an init parameter.
227
+
228
+
```php
229
+
$vwoClient = VWO::init([
230
+
'sdkKey' => '32-alpha-numeric-sdk-key',
231
+
'accountId' => '123456',
232
+
'shouldWaitForTrackingCalls' => true,
233
+
]);
234
+
```
235
+
236
+
Notes:
237
+
- In PHP, the default transport for tracking is a non-blocking socket-based call (fire-and-forget).
238
+
- When you enable `shouldWaitForTrackingCalls`, the SDK switches to a blocking cURL-based call so your code waits for the response.
239
+
- For synchronous (cURL) calls, retry is enabled by default. You can override via `retryConfig` in init:
0 commit comments