Skip to content

Instantly share code, notes, and snippets.

@hijonathan
Created March 9, 2016 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hijonathan/717bf2a48c38c17897fb to your computer and use it in GitHub Desktop.
Save hijonathan/717bf2a48c38c17897fb to your computer and use it in GitHub Desktop.
How to send Appcues Form Submission data to Segment
Appcues.on('flow_form_submission', function(eventData) {
// Convert the responses into an object where the field label is the key and the input
// is the value.
var responsesObj = {};
// Note: if your form labels are long, you may want to shorten them in this step.
// E.g. Convert "What is your email?" to "email" in the `forEach` loop.
eventData.response.forEach(function(resp) { responseObj[resp.label] = resp.value });
// Track that the event happened.
analytics.track('Appcues Form Submitted', {
formId: eventData.formId,
value: responsesObj
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment