Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!doctype html>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="">
<link rel="stylesheet" type="text/css" href="">
<script src=""></script>
<body class="mixpanel-platform-body">
<div class="mixpanel-platform-section">
<div id="eventSelect"></div>
var eventsArray = ['Signup'];
var eventSelect = $('#eventSelect').MPEventSelect();
var runQuery = function(events) {
console.log('Making a funnel query with events:', events);
// Call the funnel endpoint passing events
// If events is ['A', 'B', 'C'], this is equivalent to calling
// MP.api.funnel('A', 'B', 'C') ...
MP.api.funnel.apply(MP.api, events).done(function(funnelData) {
// Do an initial query to render the first event node
// When the event select changes, re-query and re-render
eventSelect.on('change', function() {
var event = eventSelect.MPEventSelect('value');
// Only add events that we aren't already querying on
if (!_.contains(eventsArray, event)) {
eventsArray.push(event); // add the new event to our events array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment