Callbacks with Event Tracking

I’m setting up the JavaScript tracker for our website and am looking for a way to have a callback function with events.

The documentation provides a method for callback functions to be called after sp.js loads, but we are looking for a way to have a function that executes only after confirmation that an event has been successfully sent to the collector.

Is there currently a way to do this with snowplow or some kind of workaround?

Thanks,
Abhi

Hi @gbakulgod - good question, it’s a feature we have flipflopped about adding a couple of times. Please add your voice to the discussion here: https://github.com/snowplow/snowplow-javascript-tracker/issues/30

Thanks alex, reading the discussion was very helpful.

I was wondering if you could help me better understand one of the comments made by yalisassoon on the forum:

Now that we’re pushing events to localStorage so that they can be fired on a subsequent page if the page is reloaded v quickly, should we close this issue?

How exactly does snowplow save the events to localStorage? And how confident can we be that the events will be fired regardless of page reloads?

Hi @gbakulgod - you can read more about how the JavaScript Tracker uses localStorage here: