Last active
August 10, 2016 14:38
-
-
Save hijonathan/fe2a1e6628d560564bf7 to your computer and use it in GitHub Desktop.
How to send Appcues form data to your HubSpot Enterprise account.
This file contains hidden or 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
| // If you're using HubSpot Enterprise Events, you can send Appcues form info to HubSpot like this. | |
| // Appcues Forms Documentation: http://inside.appcues.com/docs/#flow_form_submission | |
| // HubSpot Enterprise Documentation: http://developers.hubspot.com/docs/methods/enterprise_events/javascript_api | |
| _hsq.push(['identify', {email: $user_email}]); | |
| Appcues.on('form_submitted', function(eventData) { | |
| // Track that the event happened. | |
| _hsq.push(['trackEvent', { | |
| id: 'appcues_form_submission_' + eventData.formId, | |
| value: eventData.interaction.response | |
| }]); | |
| // Optionally, update the contact with info from the form. | |
| 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.interaction.response.forEach(function(resp) { responseObj[resp.label] = resp.value }) | |
| _hsq.push(['identify', responsesObj]) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment