Event Tracking for Gravity Forms - Version 2.4.9

Version Description

  • Released 2021=08-22
  • Prevent GTM from sending events more than once (props @zahadum).
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 Event Tracking for Gravity Forms
Version 2.4.9
Comparing to
See all releases

Code changes from version 2.4.8 to 2.4.9

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ronalfy, bigwing, nmarks, kzeni
3
  Tags: gravity forms, google analytics, google tag manager, matomo, piwik, event tracking
4
  Requires at least: 5.5
5
  Tested up to: 5.8
6
- Stable tag: 2.4.8
7
  Requires PHP: 5.6
8
  Donate link: https://github.com/mediaron
9
  License: GPLv2 or later
@@ -15,10 +15,12 @@ Easily add event tracking using Gravity Forms and your Google Analytics or Googl
15
 
16
  This plugin provides an easy way to add event tracking to your Gravity Forms using Google Analytics and Google Tag Manager.
17
 
18
- This plugin only supports Google Analytics v3 only at this time.
19
 
20
  https://www.youtube.com/watch?v=rHW3roCuNSI&t=2s
21
 
 
 
22
  Also supports:
23
 
24
  * Pagination events
@@ -78,7 +80,9 @@ Development happens on <a href="https://github.com/ronalfy/wordpress-gravity-for
78
 
79
  = Do you support Google Analytics 4? =
80
 
81
- At this time, only version 3 of Google Analytics is supported.
 
 
82
 
83
  = How do I track pagination? =
84
 
@@ -129,6 +133,10 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
129
 
130
  == Changelog ==
131
 
 
 
 
 
132
  = 2.4.8 =
133
  * Released 2021-07-29
134
  * When a feed is successful, it'll show up under the Form entry notes.
@@ -333,5 +341,5 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
333
 
334
  == Upgrade Notice ==
335
 
336
- = 2.4.8 =
337
- When a feed is successful, it'll show up under the Form entry notes.
3
  Tags: gravity forms, google analytics, google tag manager, matomo, piwik, event tracking
4
  Requires at least: 5.5
5
  Tested up to: 5.8
6
+ Stable tag: 2.4.9
7
  Requires PHP: 5.6
8
  Donate link: https://github.com/mediaron
9
  License: GPLv2 or later
15
 
16
  This plugin provides an easy way to add event tracking to your Gravity Forms using Google Analytics and Google Tag Manager.
17
 
18
+ This plugin support Google Analytics 3 and <a href="https://mediaron.com/event-tracking-with-gravity-forms-and-google-analytics-4/">Google Analytics 4</a>.
19
 
20
  https://www.youtube.com/watch?v=rHW3roCuNSI&t=2s
21
 
22
+ https://youtube.com/playlist?list=PLw2fSxxzure57usQNLMZrIAwn3DbRmaaF
23
+
24
  Also supports:
25
 
26
  * Pagination events
80
 
81
  = Do you support Google Analytics 4? =
82
 
83
+ Check out <a href="https://mediaron.com/event-tracking-with-gravity-forms-and-google-analytics-4/">this post</a> and YouTube Playlist for how to integrate with Google Analytics 4.
84
+
85
+ https://youtube.com/playlist?list=PLw2fSxxzure57usQNLMZrIAwn3DbRmaaF
86
 
87
  = How do I track pagination? =
88
 
133
 
134
  == Changelog ==
135
 
136
+ = 2.4.9 =
137
+ * Released 2021=08-22
138
+ * Prevent GTM from sending events more than once (props @zahadum).
139
+
140
  = 2.4.8 =
141
  * Released 2021-07-29
142
  * When a feed is successful, it'll show up under the Form entry notes.
341
 
342
  == Upgrade Notice ==
343
 
344
+ = 2.4.9 =
345
+ Prevent GTM from sending events more than once (props @zahadum)
gravity-forms-event-tracking.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Gravity Forms Event Tracking
4
  * Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
5
  * Description: Add event tracking to your Gravity Forms with ease using Google Analytics, Tag Manager, or Matomo
6
- * Version: 2.4.8
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
@@ -19,7 +19,7 @@ if ( ! defined( 'WPINC' ) ) {
19
  }
20
 
21
  define( 'GFGAET_MIN_GFORMS_VERSION', '2.2.0' );
22
- define( 'GFGAET_VERSION', '2.4.8' );
23
  define( 'GFGAET_FILE', __FILE__ );
24
 
25
  class GFGAET {
3
  * Plugin Name: Gravity Forms Event Tracking
4
  * Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
5
  * Description: Add event tracking to your Gravity Forms with ease using Google Analytics, Tag Manager, or Matomo
6
+ * Version: 2.4.9
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
19
  }
20
 
21
  define( 'GFGAET_MIN_GFORMS_VERSION', '2.2.0' );
22
+ define( 'GFGAET_VERSION', '2.4.9' );
23
  define( 'GFGAET_FILE', __FILE__ );
24
 
25
  class GFGAET {
includes/GFGAET_Submission_Feeds.php CHANGED
@@ -872,18 +872,25 @@ gtag('config', '<?php echo esc_js( $ga_code ); ?>');
872
  utmContent = utmVariables.content;
873
  }
874
  if ( typeof( window.parent.dataLayer ) != 'undefined' ) {
875
- window.parent.dataLayer.push({'event': 'GFTrackEvent',
876
- 'GFTrackCategory':'<?php echo esc_js( $event_category ); ?>',
877
- 'GFTrackAction':'<?php echo esc_js( $event_action ); ?>',
878
- 'GFTrackLabel':'<?php echo esc_js( $event_label ); ?>',
879
- 'GFTrackValue': <?php echo absint( $event_value ); ?>,
880
- 'GFEntryData':<?php echo wp_json_encode( $entry ); ?>,
881
- 'GFTrackSource': utmSource,
882
- 'GFTrackMedium': utmMedium,
883
- 'GFTrackCampaign': utmCampaign,
884
- 'GFTrackTerm': utmTerm,
885
- 'GFTrackContent': utmContent,
886
- });
 
 
 
 
 
 
 
887
  }
888
  </script>
889
  <?php
872
  utmContent = utmVariables.content;
873
  }
874
  if ( typeof( window.parent.dataLayer ) != 'undefined' ) {
875
+ if (typeof(window.parent.gfaetTagManagerSent) != 'undefined' ) {
876
+ window.parent.dataLayer.push({'event': 'GFTrackEvent',
877
+ 'GFTrackCategory':'<?php echo esc_js( $event_category ); ?>',
878
+ 'GFTrackAction':'<?php echo esc_js( $event_action ); ?>',
879
+ 'GFTrackLabel':'<?php echo esc_js( $event_label ); ?>',
880
+ 'GFTrackValue': <?php echo absint( $event_value ); ?>,
881
+ 'GFEntryData':<?php echo wp_json_encode( $entry ); ?>,
882
+ 'GFTrackSource': utmSource,
883
+ 'GFTrackMedium': utmMedium,
884
+ 'GFTrackCampaign': utmCampaign,
885
+ 'GFTrackTerm': utmTerm,
886
+ 'GFTrackContent': utmContent,
887
+ });
888
+ }
889
+ }
890
+ try {
891
+ window.parent.gfaetTagManagerSent = true; <?php // Prevent tag manager from sending multiple events. ?>
892
+ } catch ( e ) {
893
+ // Catch error.
894
  }
895
  </script>
896
  <?php