Widget events (Send Data To Your Analytics App)

Updated a few seconds ago ​by Matt Bilotti

If you're trying to send Drift events from the JavaScript SDK to Google Analytics, or any other system, to measure when conversations are started, you're in luck!

Each time a conversation is started, the Drift widget fires off a startConversation event.  The JavaScript SDK's on method lets you subscribe to those events and provide a function that is called whenever the event occurs.

In this example, we subscribe to startConversation events with a function that tracks them in Google Analytics:

// Register an event handler for `startConversation` events
window.drift.on("startConversation", function() {
  console.log("started a new chat!");
  // send the event to Google Analytics
  window.ga("send", "event", "Drift", "startConversation");
});

Here's an article that explains how to send events to Google Analytics in case you need it. 

If you're already integrated with analytics.js (also can be used if you're a Segment Integration user), just listen for startConversation, pass that along to wherever you want, and you'll be all set.


Here is the complete list of events we track.

Was this article helpful?


Can’t find what you’re looking for?

Talk To Us