Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-7453

Implement new dataLayer variable for email in Gravity Forms (form_submission event)

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Accepted
    • Icon: Should have Should have
    • 2.128.0
    • None
    • 3
    • Analytics, Forms
    • Sprint #233, Sprint #234
    • neptune

      Summary

      One of the challenges with Mixpanel implementation is the need to manage user identification. We have so far relied on Google Analytics which identifies users through their logged-in state on Google accounts, but with Mixpanel we won’t be able to match the same users across devices unless we send them an unique user_id. We have designed a proposal to use hashed emails (from formSubmission events) as the unique user_id. The hashing process and all subsequent steps will be handled by Google Tag Manager, but we need to be able to read the submitted email from the dataLayer. 

      Requirements

      • In all formSubmission dataLayer event sent from Gravity Forms, we need to include a new variable 'userEmail' with the email submitted by the user:
        • 'userEmail': 'test@gmail.com' (example) 

      This needs to be implemented in Gravity Forms. 

      Resources

      <!-- Hubspot Form Event Listener: Form Submission -->    
      <script type="text/javascript">
           window.addEventListener("message", function(event) {
              if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {
                 window.dataLayer.push({
                    'event': 'formSubmission',
                    'gGoal':'Petition Signup',
                    'formID': event.data.id,
                    'formPlugin': 'Hubspot', 
                    'hs-form-guid': event.data.id,
                    'userEmail': event.data.data.submissionValues.email
               });
              }
           });
      </script>
      <!-- END Hubspot Form Event Listener: Form Submission -->
       

            sdeshmuk Sagar Deshmukh
            jmarubay Julia Marubayashi
            Julia Marubayashi Julia Marubayashi
            Maud Leray Maud Leray
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: