Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
CDPCloud Portal
Sitecore CDP Developer Documentation
  • Developing with Sitecore CDP
            • Engage.init(settings)
            • Engage.initServer(settings)
            • Engage.initServer.handleCookie(req, res)
            • Engage.getBrowserId()
            • Engage.getGuestId()
            • Engage.updatePointOfSale(pointOfSale)
            • Engage.pageView(eventData[, extensionData])
            • Engage.identity(eventData[, extensionData])
            • Engage.event(type, eventData[, extensionData])
            • Engage.addToEventQueue(type, eventData[, extensionData])
            • Engage.processEventQueue()
            • Engage.clearEventQueue()
            • EngageServer.pageView(eventData, req[, extensionData])
            • EngageServer.identity(eventData, req[, extensionData])
            • EngageServer.event(type, eventData, req[, extensionData])
            • window.Engage.triggerExperiences()
        • Troubleshooting
        • Release notes
  1. Functions
  1. Stream API
  2. Functions
  3. Engage.clearEventQueue()

Engage.clearEventQueue()

The clearEventQueue() function empties the event queue, removing all the events that are in it, without sending any of the events.

sidebar. Parameters

none

Here's an example of how to use the clearEventQueue function to empty the event queue.

In this scenario, we add different events to the event queue depending on whether a site visitor clicked a dropdown menu and a dropdown menu item.

If a certain condition is met, you decide to empty the event queue and not send any of the events you previously added to it.

if (clickedDropdown) {
  engage.addToEventQueue("DROPDOWN_CLICK", eventData);

  if (clickedDropdownItem) {
    engage.addToEventQueue("DROPDOWN_ITEM_CLICK", eventData);
  } else {
    engage.addToEventQueue("DROPDOWN_ABANDON", eventData);
  };

  if (timeout) {
    engage.clearEventQueue();
  };
};
If you have suggestions for improving this article, let us know!

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use