MediaRon / gravity-forms-google-analytics-event-tracking

Use event tracking with Google Analytics
https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
GNU General Public License v2.0
65 stars 14 forks source link

Sometimes missing events when pushing with Google Analytics Measurement Protocol. #42

Open alexincore opened 2 years ago

alexincore commented 2 years ago

Hi, I found that we sometimes miss form submission events in our Google Analytics. After checking each and every corner, I found only one place that could fail. Specifically, when submitting the event in this loop:

            foreach ( $google_analytics_codes as $ua_code ) {
                // Submit the event
                $event->send( $ua_code );
            }
            $this->add_note( $entry['id'], __( 'An event has been sent using the Google Analytics Measurement Protocol.', 'gravity-forms-google-analytics-event-tracking' ), 'success' );

There's nothing that checks the result of ->send(), neither here, nor in the send function itself. Thus some events may slip through (temporary network issues, routing problems, timeouts, DNS resolve errors etc. etc.). Is there any way you can implement a retry of some sort, and/or maybe at least call an add_note with specific parameters depending on the result of send()?