Created
March 9, 2016 04:01
-
-
Save hijonathan/717bf2a48c38c17897fb to your computer and use it in GitHub Desktop.
How to send Appcues Form Submission data to Segment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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