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

Automatically fire data layer script on GF donation confirmation Pages


    • Icon: Task Task
    • Resolution: Merged
    • Icon: Should have Should have
    • 2.107.0
    • None
    • 3
    • Analytics
    • Sprint #206, Sprint #207, Sprint #208, Sprint #209, Sprint #210, Sprint #211, Sprint #212
    • saturn


      The Gravity Forms Google Analytics plugin doesn't work for forms with the "donation" form type. Once the user completes the donation on Stripe, they are redirected to the P4 Thank You page, and there's no standard GFTrackEvent or FormSubmission event there.

      The GPI Analytics team (aka Julia and Mariusz) has a temporary solution - manually adding a dataLayer script in the HTML of the Confirmation Message:

      1. ript> window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'formSubmission', 'gGoal': 'Donation', 'formPlugin': 'Gravity Forms', 'formID': ' {form_id}

        ', // you can replace that 2 with anything you want. Just make sure it makes sense to you. 'formTitle': '{form_title}', 'formValue': '{amount_total:21}' }); </script>

      Tag manager then looks for a formSubmission event where gGoal equals Donation. Then we have an e-commerce script to track the transactions:



      1. Send events automatically from the confirmation page: Right now we're adding the script manually, it'd be great if we can automatically fire the dataLayer script on the confirmation page (for Donation form types)
      1. Investigate how to obtain the missing information in e-commerce script: The parameters transaction_id, item_id, currency, and payment method aren't passing from Stripe to P4 - we aren't sure why that is or how to get them. Any ideas? 


            fhernand Florent Hernandez
            mmarcott Molly Marcott
            Sagar Deshmukh Sagar Deshmukh
            0 Vote for this issue
            1 Start watching this issue