Version Description
- Released 2018-08-27
- Adding support for gtag
Download this release
Release Info
| Developer | ronalfy |
| Plugin | |
| Version | 2.2.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2.1 to 2.2.2
- README.txt +8 -1
- gravity-forms-event-tracking.php +1 -1
- includes/GFGAET_Submission_Feeds.php +35 -22
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:4.0
|
| 5 |
Tested up to: 4.9
|
| 6 |
-
Stable tag: 2.2.
|
| 7 |
Requires PHP: 5.6
|
| 8 |
Donate link: https://mediaron.com/give/
|
| 9 |
License: GPLv2 or later
|
|
@@ -116,6 +116,10 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
|
|
| 116 |
|
| 117 |
== Changelog ==
|
| 118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
= 2.2.1 =
|
| 120 |
* Released 2018-08-23
|
| 121 |
* Bug fix: Blank event values were being sent in Google Analytics mode, which resulted in failed conversions
|
|
@@ -247,6 +251,9 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
|
|
| 247 |
|
| 248 |
== Upgrade Notice ==
|
| 249 |
|
|
|
|
|
|
|
|
|
|
| 250 |
= 2.2.1 =
|
| 251 |
Bug fix: Blank event values were being sent in Google Analytics mode, which resulted in failed conversions. Please double-check your conversions after you update.
|
| 252 |
|
| 3 |
Tags: gravity forms, google analytics, google tag manager, matomo, piwik, event tracking
|
| 4 |
Requires at least:4.0
|
| 5 |
Tested up to: 4.9
|
| 6 |
+
Stable tag: 2.2.2
|
| 7 |
Requires PHP: 5.6
|
| 8 |
Donate link: https://mediaron.com/give/
|
| 9 |
License: GPLv2 or later
|
| 116 |
|
| 117 |
== Changelog ==
|
| 118 |
|
| 119 |
+
= 2.2.2 =
|
| 120 |
+
* Released 2018-08-27
|
| 121 |
+
* Adding support for gtag
|
| 122 |
+
|
| 123 |
= 2.2.1 =
|
| 124 |
* Released 2018-08-23
|
| 125 |
* Bug fix: Blank event values were being sent in Google Analytics mode, which resulted in failed conversions
|
| 251 |
|
| 252 |
== Upgrade Notice ==
|
| 253 |
|
| 254 |
+
= 2.2.2 =
|
| 255 |
+
Adding support for gtag
|
| 256 |
+
|
| 257 |
= 2.2.1 =
|
| 258 |
Bug fix: Blank event values were being sent in Google Analytics mode, which resulted in failed conversions. Please double-check your conversions after you update.
|
| 259 |
|
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 (formerly Piwik).
|
| 6 |
-
* Version: 2.2.
|
| 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 event tracking to your Gravity Forms with ease using Google Analytics, Tag Manager, or Matomo (formerly Piwik).
|
| 6 |
+
* Version: 2.2.2
|
| 7 |
* Author: Ronald Huereca
|
| 8 |
* Author URI: https://mediaron.com
|
| 9 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
includes/GFGAET_Submission_Feeds.php
CHANGED
|
@@ -353,29 +353,42 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
|
|
| 353 |
?>
|
| 354 |
var feed_submission = sessionStorage.getItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>');
|
| 355 |
if ( null == feed_submission ) {
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
window.parent.ga(function(tracker) {
|
| 366 |
-
default_ua_code = tracker.get('trackingId');
|
| 367 |
-
});
|
| 368 |
-
|
| 369 |
-
// If UA code matches, use that tracker
|
| 370 |
-
if ( default_ua_code == '<?php echo esc_js( $ua_code ); ?>' ) {
|
| 371 |
-
window.parent.ga( 'send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>'<?php if ( 0 !== $event_value && !empty( $event_value ) ) { echo ',' . "'" . esc_js( $event_value ) . "'"; } ?>);
|
| 372 |
-
} else {
|
| 373 |
-
// UA code doesn't match, use another tracker
|
| 374 |
-
window.parent.ga( 'create', '<?php echo esc_js( $ua_code ); ?>', 'auto', 'GTGAET_Tracker<?php echo absint( $count ); ?>' );
|
| 375 |
-
window.parent.ga( 'GTGAET_Tracker<?php echo absint( $count ); ?>.send', 'event', '<?php echo esc_js( $event_category );?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>'<?php if ( 0 !== $event_value ) { echo ',' . "'" . esc_js( $event_value ) . "'"; } ?>);
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
sessionStorage.setItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
}
|
| 380 |
}
|
| 381 |
|
| 353 |
?>
|
| 354 |
var feed_submission = sessionStorage.getItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>');
|
| 355 |
if ( null == feed_submission ) {
|
| 356 |
+
|
| 357 |
+
// Check for gtab implementation
|
| 358 |
+
if( typeof window.parent.gtag != 'undefined' ) {
|
| 359 |
+
window.parent.gtag( 'event', '<?php echo esc_js( $event_action ); ?>', {
|
| 360 |
+
'event_category': '<?php echo esc_js( $event_category ); ?>',
|
| 361 |
+
'event_label': '<?php echo esc_js( $event_label ); ?>'
|
| 362 |
+
<?php if ( 0 !== $event_value && !empty( $event_value ) ) { echo sprintf( ",'value': '%s'", esc_js( $event_value ) ); } ?>
|
| 363 |
+
}
|
| 364 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
sessionStorage.setItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>', true );
|
| 366 |
+
} else {
|
| 367 |
+
// Check for GA from Monster Insights Plugin
|
| 368 |
+
if ( typeof window.parent.ga == 'undefined' ) {
|
| 369 |
+
if ( typeof window.parent.__gaTracker != 'undefined' ) {
|
| 370 |
+
window.parent.ga = window.parent.__gaTracker;
|
| 371 |
+
}
|
| 372 |
+
}
|
| 373 |
+
if ( typeof window.parent.ga != 'undefined' ) {
|
| 374 |
+
|
| 375 |
+
// Try to get original UA code from third-party plugins or tag manager
|
| 376 |
+
var default_ua_code = null;
|
| 377 |
+
window.parent.ga(function(tracker) {
|
| 378 |
+
default_ua_code = tracker.get('trackingId');
|
| 379 |
+
});
|
| 380 |
+
|
| 381 |
+
// If UA code matches, use that tracker
|
| 382 |
+
if ( default_ua_code == '<?php echo esc_js( $ua_code ); ?>' ) {
|
| 383 |
+
window.parent.ga( 'send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>'<?php if ( 0 !== $event_value && !empty( $event_value ) ) { echo ',' . "'" . esc_js( $event_value ) . "'"; } ?>);
|
| 384 |
+
} else {
|
| 385 |
+
// UA code doesn't match, use another tracker
|
| 386 |
+
window.parent.ga( 'create', '<?php echo esc_js( $ua_code ); ?>', 'auto', 'GTGAET_Tracker<?php echo absint( $count ); ?>' );
|
| 387 |
+
window.parent.ga( 'GTGAET_Tracker<?php echo absint( $count ); ?>.send', 'event', '<?php echo esc_js( $event_category );?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>'<?php if ( 0 !== $event_value ) { echo ',' . "'" . esc_js( $event_value ) . "'"; } ?>);
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
sessionStorage.setItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>', true );
|
| 391 |
+
}
|
| 392 |
}
|
| 393 |
}
|
| 394 |
|
