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: src/connections/sources/catalog/libraries/website/javascript/index.md
-50Lines changed: 0 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -691,56 +691,6 @@ Your total batched events can’t exceed the maximum payload size of 500 KB, wit
691
691
#### Timeout
692
692
`timeout` is the number of milliseconds that forces all events queued for batching to be sent, regardless of the batch size, once it’s reached. For example, `timeout: 5000` sends every event in the batch to Segment once 5 seconds passes.
693
693
694
-
### Implicit and explicit batching
695
-
All batching is done implicitly as it doesn’t require you to change your Analytics.js implementation. Implicit batching is a great option is you want an out of the box approach to batching as you only need to add the required parameters to your load method (mentioned above in Setup) and Analytics.js will handle the rest.
696
-
697
-
You can fire your analytics events as usual and assume they’ll be delivered the same as individual events would. This code block shows implicit batching:
698
-
699
-
```js
700
-
701
-
// Implicit Batching
702
-
703
-
analytics.page('Checkout')
704
-
analytics.identify('User ID')
705
-
analytics.track('Checkout seen')
706
-
707
-
// some time later
708
-
analytics.track('Product Added')
709
-
analytics.track('Checkout clicked')
710
-
711
-
// These 5 events will potentially be delivered in the same batch, depending on how far apart they're executed (based on batching config)
712
-
```
713
-
714
-
If you want to guarantee which specific events are delivered together in the batch, you can set up explicit batching by using `await Promise` and changing the implicit code example above to this:
715
-
716
-
```js
717
-
constcheckout=analytics.page('Checkout')
718
-
constidentify=analytics.identify('User ID')
719
-
constseen=analytics.track('Product Added')
720
-
721
-
// some time later
722
-
constadded=analytics.track('Product Added')
723
-
constclicked=analytics.track('Checkout clicked')
724
-
725
-
// Collecting all promises and awaiting on them will create an artificial batch
726
-
// This line will block execution until all events in the artificial batch have been delivered
0 commit comments