$p("sendRobust")

$p("sendRobust"): (String, Object) -> Boolean

$p("sendRobust", "widget_click", {
  clickUrl: "http://asdfasdf.com/asdf", // for widget_click event
  customContextA : "value1",
  customContextB : "value2"
})

📘

Used for custom tracking functions

For an example of how sendRobust is used for sending widget click events, see our documentation on Tracking with no Anchor.

sendRobust sends an event to LiftIgniter just like the send function. However, it's different from send in that it queues the event in a buffer, and sends it on user's new pageview to make sure that the event is sent. This takes care of the case where page redirect happens before sending the click event.

The function returns false if local storage and cookies are unavailable as a buffer. So if you want to add a small frame of time (let's say for instance, 100 ms), you can consider the following:

if(!$p("sendRobust","widget_click", {"clickUrl":"url"})){
  $p("send","widget_click", {"clickUrl":"url"});
  // event object will be passed from any click listener that you implement.
  // https://developer.mozilla.org/en-US/docs/Web/API/Event
  if (!event.metaKey && !event.shiftKey && event.type == "click") {
    event.preventDefault();
    win.setTimeout(function() {
      win.location.href = url;
    }, 100);
  } 
}