Event Tracking for Gravity Forms - Version 2.4.5

Version Description

  • Released 2021-07-26
  • Cleaning up settings page.
Download this release

Release Info

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

Code changes from version 2.4.2 to 2.4.5

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.2
7
  Requires PHP: 5.6
8
  Donate link: https://github.com/mediaron
9
  License: GPLv2 or later
@@ -129,6 +129,10 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
129
 
130
  == Changelog ==
131
 
 
 
 
 
132
  = 2.4.2 =
133
  * Released 2021-06-22
134
  * Fixing preview and ajax-only forms.
@@ -319,11 +323,5 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
319
 
320
  == Upgrade Notice ==
321
 
322
- = 2.4.2 =
323
- Fixing preview and ajax-only forms.
324
-
325
- = 2.4.1 =
326
- Fixing index errors in PHP logs.
327
-
328
- = 2.4.0 =
329
- Requires Gravity Forms 2.5+. Numerous cosmetic changes. Track UTM variables. Install GA or GTM using the add-on as needed.
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.5
7
  Requires PHP: 5.6
8
  Donate link: https://github.com/mediaron
9
  License: GPLv2 or later
129
 
130
  == Changelog ==
131
 
132
+ = 2.4.5 =
133
+ * Released 2021-07-26
134
+ * Cleaning up settings page.
135
+
136
  = 2.4.2 =
137
  * Released 2021-06-22
138
  * Fixing preview and ajax-only forms.
323
 
324
  == Upgrade Notice ==
325
 
326
+ = 2.4.5 =
327
+ Cleaning up settings screen.
 
 
 
 
 
 
css/admin.css ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .gform-settings-choice.gform-settings-choice--visual.gform-settings-choice--inline {
2
+ display: inline-block;
3
+ }
4
+ /* Fix tooltips in Gforms 2.5 for Visual Horizontal mode */
5
+ .gform-settings-choice.gform-settings-choice--visual.gform-settings-choice--inline
6
+ .gf_tooltip.tooltip {
7
+ align-items: center;
8
+ background: #ecedf8;
9
+ border: none;
10
+ border-radius: 50%;
11
+ box-sizing: border-box;
12
+ color: #242748;
13
+ display: inline-flex;
14
+ font-size: 0.5rem;
15
+ height: 1rem;
16
+ justify-content: center;
17
+ margin-left: 0.25rem;
18
+ position: relative;
19
+ text-decoration: none;
20
+ vertical-align: middle;
21
+ width: 1rem;
22
+ }
23
+ .gform-settings-choice.gform-settings-choice--visual.gform-settings-choice--inline
24
+ .gf_tooltip.tooltip:before {
25
+ border: 0.0625rem solid transparent;
26
+ border-radius: 100%;
27
+ content: ' ';
28
+ display: block;
29
+ height: 0.875rem;
30
+ left: 0;
31
+ position: absolute;
32
+ top: 0;
33
+ transition: border-color 200ms ease-in-out, box-shadow 200ms ease-in-out;
34
+ transition-delay: 100ms;
35
+ width: 0.875rem;
36
+ }
37
+ .gform-settings-choice.gform-settings-choice--visual.gform-settings-choice--inline .gf_tooltip.tooltip .gform-icon--question-mark {
38
+ font-family: 'gform-icons-admin' !important;
39
+ font-style: normal;
40
+ font-weight: normal;
41
+ font-feature-settings: normal;
42
+ font-variant: normal;
43
+ text-transform: none;
44
+ line-height: 1;
45
+ -webkit-font-smoothing: antialiased;
46
+ -moz-osx-font-smoothing: grayscale;
47
+ }
48
+ .gform-settings-choice.gform-settings-choice--visual.gform-settings-choice--inline .gform-icon.gform-icon--question-mark {
49
+ color: #242748;
50
+ font-size: 0.5rem;
51
+ vertical-align: middle;
52
+ margin-bottom: 0;
53
+ }
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.2
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
@@ -19,7 +19,8 @@ if ( ! defined( 'WPINC' ) ) {
19
  }
20
 
21
  define( 'GFGAET_MIN_GFORMS_VERSION', '2.2.0' );
22
- define( 'GFGAET_VERSION', '2.4.2' );
 
23
 
24
  class GFGAET {
25
 
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.5
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.5' );
23
+ define( 'GFGAET_FILE', __FILE__ );
24
 
25
  class GFGAET {
26
 
includes/GFGAET_Pagination.php CHANGED
@@ -164,10 +164,10 @@ class GFGAET_Pagination {
164
  // UA code doesn't match, use another tracker
165
  window.parent.ga( 'create', '<?php echo esc_js( $ua_code ); ?>', 'auto', 'GTGAET_Tracker' );
166
  window.parent.ga( 'GTGAET_Tracker.send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>'
167
- <?php
168
- if ( 0 !== $event_value ) {
169
- echo ',' . "'" . esc_js( $event_value ) . "'"; }
170
- ?>
171
  );
172
  }
173
  }
164
  // UA code doesn't match, use another tracker
165
  window.parent.ga( 'create', '<?php echo esc_js( $ua_code ); ?>', 'auto', 'GTGAET_Tracker' );
166
  window.parent.ga( 'GTGAET_Tracker.send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>'
167
+ <?php
168
+ if ( 0 !== $event_value ) {
169
+ echo ',' . "'" . esc_js( $event_value ) . "'"; }
170
+ ?>
171
  );
172
  }
173
  }
includes/GFGAET_Submission_Feeds.php CHANGED
@@ -62,6 +62,37 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
62
  add_action( 'gform_preview_header', array( $this, 'preview_header' ) );
63
  add_action( 'gform_preview_body_open', array( $this, 'tag_manager_after_body' ) );
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
 
67
  /**
@@ -377,6 +408,27 @@ gtag('config', '<?php echo esc_js( $ga_code ); ?>');
377
  }
378
  }
379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  /**
381
  * Retrieve KSES allowed tags for Google Analytics and/or Tag Manager.
382
  *
62
  add_action( 'gform_preview_header', array( $this, 'preview_header' ) );
63
  add_action( 'gform_preview_body_open', array( $this, 'tag_manager_after_body' ) );
64
  }
65
+
66
+ add_filter(
67
+ 'plugin_action_links_' . plugin_basename( GFGAET_FILE ),
68
+ array( $this, 'add_settings_link' )
69
+ );
70
+ }
71
+
72
+ /**
73
+ * Add a settings link to the plugin's options.
74
+ *
75
+ * Add a settings link on the WordPress plugin's page.
76
+ *
77
+ * @since 2.4.5
78
+ * @access public
79
+ *
80
+ * @see init
81
+ *
82
+ * @param array $links Array of plugin options.
83
+ * @return array $links Array of plugin options
84
+ */
85
+ public function add_settings_link( $links ) {
86
+
87
+ $settings_url = admin_url( 'admin.php?page=gf_settings&subview=GFGAET_UA');
88
+ if ( current_user_can( 'manage_options' ) ) {
89
+ $options_link = sprintf( '<a href="%s">%s</a>', esc_url( $settings_url ), _x( 'Settings', 'Gravity Forms Event Tracking Settings page', 'gravity-forms-google-analytics-event-tracking' ) );
90
+ $links[] = $options_link;
91
+ }
92
+ $docs_link = sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'https://mediaron.com/event-tracking-for-gravity-forms/?utm_source=wordpress_plugins_page&utm_medium=documentation&utm_campaign=event_tracking' ), _x( 'Documentation', 'Gravity Forms Event Tracking Documentation page', 'gravity-forms-google-analytics-event-tracking' ) );
93
+ $links[] = $docs_link;
94
+
95
+ return $links;
96
  }
97
 
98
  /**
408
  }
409
  }
410
 
411
+ /**
412
+ * Outputs admin scripts to handle form submission in back-end.
413
+ *
414
+ * @since 2.4.5
415
+ *
416
+ * @return array
417
+ */
418
+ public function styles() {
419
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || rgget( 'gform_debug' ) ? '' : '.min';
420
+ $styles = array(
421
+ array(
422
+ 'handle' => 'gfgaet_admin',
423
+ 'enqueue' => array(
424
+ array( 'query' => 'page=gf_settings&subview=GFGAET_UA' ),
425
+ ),
426
+ 'src' => esc_url( GFGAET::get_plugin_url( '/css/admin.css' ) ),
427
+ ),
428
+ );
429
+ return array_merge( parent::styles(), $styles );
430
+ }
431
+
432
  /**
433
  * Retrieve KSES allowed tags for Google Analytics and/or Tag Manager.
434
  *
includes/GFGAET_UA.php CHANGED
@@ -67,7 +67,7 @@ class GFGAET_UA extends GFAddOn {
67
  array(
68
  'type' => 'radio',
69
  'name' => 'mode',
70
- 'horizontal' => false,
71
  'default_value' => 'gmp',
72
  'label' => 'How would you like to send events?',
73
  'choices' => array(
@@ -76,18 +76,21 @@ class GFGAET_UA extends GFAddOn {
76
  'label' => esc_html__( 'Measurement Protocol (Default)', 'gravity-forms-google-analytics-event-tracking' ),
77
  'value' => 'gmp',
78
  'icon' => GFGAET::get_plugin_url( '/img/google-brands.png' ),
 
79
  ),
80
  array(
81
  'name' => 'ga_on',
82
  'label' => esc_html__( 'Google Analytics (Ajax only forms)', 'gravity-forms-google-analytics-event-tracking' ),
83
  'value' => 'ga',
84
  'icon' => GFGAET::get_plugin_url( '/img/analytics.png' ),
 
85
  ),
86
  array(
87
  'name' => 'gtm_on',
88
  'label' => esc_html__( 'Google Tag Manager (Ajax only forms)', 'gravity-forms-google-analytics-event-tracking' ),
89
  'value' => 'gtm',
90
  'icon' => GFGAET::get_plugin_url( '/img/gtm.png' ),
 
91
  ),
92
  ),
93
  ),
67
  array(
68
  'type' => 'radio',
69
  'name' => 'mode',
70
+ 'horizontal' => true,
71
  'default_value' => 'gmp',
72
  'label' => 'How would you like to send events?',
73
  'choices' => array(
76
  'label' => esc_html__( 'Measurement Protocol (Default)', 'gravity-forms-google-analytics-event-tracking' ),
77
  'value' => 'gmp',
78
  'icon' => GFGAET::get_plugin_url( '/img/google-brands.png' ),
79
+ 'tooltip' => esc_html__( 'This option will send analytics server-to-server using the measurement protocol', 'gravity-forms-google-analytics-event-tracking' ),
80
  ),
81
  array(
82
  'name' => 'ga_on',
83
  'label' => esc_html__( 'Google Analytics (Ajax only forms)', 'gravity-forms-google-analytics-event-tracking' ),
84
  'value' => 'ga',
85
  'icon' => GFGAET::get_plugin_url( '/img/analytics.png' ),
86
+ 'tooltip' => esc_html__( 'Send form data via JavaScript using an existing Google Analytics account.', 'gravity-forms-google-analytics-event-tracking' ),
87
  ),
88
  array(
89
  'name' => 'gtm_on',
90
  'label' => esc_html__( 'Google Tag Manager (Ajax only forms)', 'gravity-forms-google-analytics-event-tracking' ),
91
  'value' => 'gtm',
92
  'icon' => GFGAET::get_plugin_url( '/img/gtm.png' ),
93
+ 'tooltip' => esc_html__( 'Send form data via JavaScript using an existing Google Tag Manager account.', 'gravity-forms-google-analytics-event-tracking' ),
94
  ),
95
  ),
96
  ),