Event Tracking for Gravity Forms - Version 2.0.9

Version Description

  • Released 2017-11-29
  • Bug fix: added host name to measurement protocol due to filters blocking the conversion.
  • Bug fix: fixed document location using the measurement protocol
  • Bug fix: changed measurement protocol server-to-server call to something less strict to prevent inadvertent blocking on some servers.
Download this release

Release Info

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

Code changes from version 2.0.7 to 2.0.9

README.txt CHANGED
@@ -1,17 +1,20 @@
1
- === Gravity Forms Google Analytics Event Tracking ===
2
  Contributors: ronalfy, bigwing, nmarks
3
  Tags: gravity forms, google analytics, google tag manager, event tracking
4
  Requires at least:4.0
5
  Tested up to: 4.9
6
- Stable tag: 2.0.7
 
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Add Google Analytics Event Tracking to your Gravity Forms in less than 5 minutes! Requires PHP 5.3+.
11
 
12
  == Description ==
13
 
14
- This plugin provides an easy way to add Google Analytics event tracking to your Gravity Forms, allowing you to properly track form submissions as events/conversions within Google Analytics.
 
 
15
 
16
  Also supports:
17
 
@@ -23,7 +26,6 @@ Also supports:
23
  Looking for help setting things up? [Read Our Setup Guide](https://bigwing.com/nest/gravity-forms-event-tracking-google-analytics)
24
 
25
  = Minimum Requirements =
26
- - PHP 5.3+
27
  - Gravity Forms 2.0+
28
  - Google Analytics Universal Analytics
29
  - Google Tag Manager (optional)
@@ -46,7 +48,6 @@ For payment based forms, you can leave the value blank to convert using the tota
46
  == Installation ==
47
 
48
  = Minimum Requirements =
49
- - PHP 5.3+
50
  - Gravity Forms 2.0+
51
 
52
  = Using The WordPress Dashboard =
@@ -98,6 +99,12 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
101
  = 2.0.7 =
102
  * Released 2017-11-03
103
  * Bug fix: events were not being sent using the measurement protocol on some installations
@@ -204,5 +211,5 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
204
 
205
  == Upgrade Notice ==
206
 
207
- = 2.0.7 =
208
- A fix to the measurement protocol. Please verify your conversions.
1
+ === Event Tracking for Gravity Forms ===
2
  Contributors: ronalfy, bigwing, nmarks
3
  Tags: gravity forms, google analytics, google tag manager, event tracking
4
  Requires at least:4.0
5
  Tested up to: 4.9
6
+ Stable tag: 2.0.9
7
+ Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Easily add event tracking using Gravity Forms and your Google Analytics or Google Tag Manager account.
12
 
13
  == Description ==
14
 
15
+ This plugin provides an easy way to add event tracking to your Gravity Forms using Google Analytics or Google Tag Manager.
16
+
17
+ Properly track for submissions as events/conversions in Google Analytics.
18
 
19
  Also supports:
20
 
26
  Looking for help setting things up? [Read Our Setup Guide](https://bigwing.com/nest/gravity-forms-event-tracking-google-analytics)
27
 
28
  = Minimum Requirements =
 
29
  - Gravity Forms 2.0+
30
  - Google Analytics Universal Analytics
31
  - Google Tag Manager (optional)
48
  == Installation ==
49
 
50
  = Minimum Requirements =
 
51
  - Gravity Forms 2.0+
52
 
53
  = Using The WordPress Dashboard =
99
 
100
  == Changelog ==
101
 
102
+ = 2.0.9 =
103
+ * Released 2017-11-29
104
+ * Bug fix: added host name to measurement protocol due to filters blocking the conversion.
105
+ * Bug fix: fixed document location using the measurement protocol
106
+ * Bug fix: changed measurement protocol server-to-server call to something less strict to prevent inadvertent blocking on some servers.
107
+
108
  = 2.0.7 =
109
  * Released 2017-11-03
110
  * Bug fix: events were not being sent using the measurement protocol on some installations
211
 
212
  == Upgrade Notice ==
213
 
214
+ = 2.0.9 =
215
+ Numerous fixes to the measurement protocol. Please verify your conversions.
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 Google Analytics event tracking to your Gravity Forms with ease.
6
- * Version: 2.0.7
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
3
  * Plugin Name: Gravity Forms Event Tracking
4
  * Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
5
  * Description: Add Google Analytics event tracking to your Gravity Forms with ease.
6
+ * Version: 2.0.9
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
includes/GFGAET_Measurement_Protocol.php CHANGED
@@ -13,6 +13,7 @@ class GFGAET_Measurement_Protocol {
13
  private $dp = ''; // Document Path
14
  private $dl = ''; // Document Location
15
  private $dt = ''; // Document Title
 
16
 
17
  public function init() {
18
  $this->cid = $this->create_client_id();
@@ -38,6 +39,10 @@ class GFGAET_Measurement_Protocol {
38
  $this->dp = $document_path;
39
  }
40
 
 
 
 
 
41
  public function set_document_location( $document_location ) {
42
  $this->dl = $document_location;
43
  }
@@ -60,6 +65,7 @@ class GFGAET_Measurement_Protocol {
60
  'dp',
61
  'dl',
62
  'dt',
 
63
  );
64
  $mp_body = array(
65
  'tid' => $ua_code,
@@ -73,7 +79,7 @@ class GFGAET_Measurement_Protocol {
73
  $payload = add_query_arg( $mp_body, $this->endpoint );
74
 
75
  // Perform the POST
76
- $response = wp_safe_remote_get( esc_url_raw( $payload ) );
77
  }
78
 
79
 
13
  private $dp = ''; // Document Path
14
  private $dl = ''; // Document Location
15
  private $dt = ''; // Document Title
16
+ private $dh = ''; // Document Host Name
17
 
18
  public function init() {
19
  $this->cid = $this->create_client_id();
39
  $this->dp = $document_path;
40
  }
41
 
42
+ public function set_document_host( $document_host ) {
43
+ $this->dh = $document_host;
44
+ }
45
+
46
  public function set_document_location( $document_location ) {
47
  $this->dl = $document_location;
48
  }
65
  'dp',
66
  'dl',
67
  'dt',
68
+ 'dh',
69
  );
70
  $mp_body = array(
71
  'tid' => $ua_code,
79
  $payload = add_query_arg( $mp_body, $this->endpoint );
80
 
81
  // Perform the POST
82
+ $response = wp_remote_get( esc_url_raw( $payload ) );
83
  }
84
 
85
 
includes/GFGAET_Submission_Feeds.php CHANGED
@@ -272,7 +272,9 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
272
 
273
  // Set some defaults
274
  $event->set_document_path( str_replace( home_url(), '', $entry[ 'source_url' ] ) );
275
- $event->set_document_location( $ga_event_data['document_location'] );
 
 
276
  $event->set_document_title( $ga_event_data['document_title'] );
277
 
278
  // Set our event object variables
272
 
273
  // Set some defaults
274
  $event->set_document_path( str_replace( home_url(), '', $entry[ 'source_url' ] ) );
275
+ $event_url_parsed = parse_url( home_url() );
276
+ $event->set_document_host( $event_url_parsed[ 'host' ] );
277
+ $event->set_document_location( str_replace( '//', '/', 'http' . ( isset( $_SERVER['HTTPS'] ) ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI'] ) );
278
  $event->set_document_title( $ga_event_data['document_title'] );
279
 
280
  // Set our event object variables