Version Description
- Released 2018-11-14
- Added pagination settings to Gravity Forms form settings screen for per-form override
Download this release
Release Info
Developer | ronalfy |
Plugin | Event Tracking for Gravity Forms |
Version | 2.3.5 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.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:4.0
|
5 |
Tested up to: 5.0
|
6 |
-
Stable tag: 2.3.
|
7 |
Requires PHP: 5.6
|
8 |
Donate link: https://mediaron.com/give/
|
9 |
License: GPLv2 or later
|
@@ -126,6 +126,10 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
|
|
126 |
|
127 |
== Changelog ==
|
128 |
|
|
|
|
|
|
|
|
|
129 |
= 2.3.2 =
|
130 |
* Released 2018-11-07
|
131 |
* Removed some checks for better event tracking
|
@@ -276,6 +280,9 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
|
|
276 |
|
277 |
== Upgrade Notice ==
|
278 |
|
|
|
|
|
|
|
279 |
= 2.3.2 =
|
280 |
Removed some checks for better event tracking. Updating filter for partial entries.
|
281 |
|
3 |
Tags: gravity forms, google analytics, google tag manager, matomo, piwik, event tracking
|
4 |
Requires at least:4.0
|
5 |
Tested up to: 5.0
|
6 |
+
Stable tag: 2.3.5
|
7 |
Requires PHP: 5.6
|
8 |
Donate link: https://mediaron.com/give/
|
9 |
License: GPLv2 or later
|
126 |
|
127 |
== Changelog ==
|
128 |
|
129 |
+
= 2.3.5 =
|
130 |
+
* Released 2018-11-14
|
131 |
+
* Added pagination settings to Gravity Forms form settings screen for per-form override
|
132 |
+
|
133 |
= 2.3.2 =
|
134 |
* Released 2018-11-07
|
135 |
* Removed some checks for better event tracking
|
280 |
|
281 |
== Upgrade Notice ==
|
282 |
|
283 |
+
= 2.3.5 =
|
284 |
+
Added pagination settings to Gravity Forms form settings screen for per-form override
|
285 |
+
|
286 |
= 2.3.2 =
|
287 |
Removed some checks for better event tracking. Updating filter for partial entries.
|
288 |
|
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.3.
|
7 |
* Author: Ronald Huereca
|
8 |
* Author URI: https://mediaron.com
|
9 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
@@ -120,6 +120,7 @@ class GFGAET {
|
|
120 |
// Initialize settings screen and feeds
|
121 |
GFAddOn::register( 'GFGAET_UA' );
|
122 |
GFAddOn::register( 'GFGAET_Submission_Feeds' );
|
|
|
123 |
if( class_exists( 'GF_Partial_Entries' ) ) {
|
124 |
GFAddOn::register( 'GFGAET_Partial_Entries' );
|
125 |
}
|
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.3.5
|
7 |
* Author: Ronald Huereca
|
8 |
* Author URI: https://mediaron.com
|
9 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
120 |
// Initialize settings screen and feeds
|
121 |
GFAddOn::register( 'GFGAET_UA' );
|
122 |
GFAddOn::register( 'GFGAET_Submission_Feeds' );
|
123 |
+
GFAddOn::register( 'GFGAET_Pagination_Settings' );
|
124 |
if( class_exists( 'GF_Partial_Entries' ) ) {
|
125 |
GFAddOn::register( 'GFGAET_Partial_Entries' );
|
126 |
}
|
includes/GFGAET_Pagination.php
CHANGED
@@ -57,7 +57,14 @@ class GFGAET_Pagination {
|
|
57 |
* @param int $source_page_number Source page number
|
58 |
* @param int $current_page_number Current Page Number
|
59 |
*/
|
60 |
-
$event_category =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
/**
|
63 |
* Filter: gform_pagination_event_action
|
@@ -71,7 +78,14 @@ class GFGAET_Pagination {
|
|
71 |
* @param int $source_page_number Source page number
|
72 |
* @param int $current_page_number Current Page Number
|
73 |
*/
|
74 |
-
$event_action =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
/**
|
77 |
* Filter: gform_pagination_event_label
|
@@ -86,6 +100,12 @@ class GFGAET_Pagination {
|
|
86 |
* @param int $current_page_number Current Page Number
|
87 |
*/
|
88 |
$event_label = sprintf( '%s::%d::%d', esc_html( $form['title'] ), absint( $source_page_number ), absint( $current_page_number ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
$event_label = apply_filters( 'gform_pagination_event_label', $event_label, $form, $source_page_number, $current_page_number );
|
90 |
|
91 |
/**
|
@@ -101,6 +121,12 @@ class GFGAET_Pagination {
|
|
101 |
* @param int $current_page_number Current Page Number
|
102 |
*/
|
103 |
$event_value = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
// Value is rounded up (Google likes integers only) before given an absolute value
|
105 |
$event_value = absint( round( GFCommon::to_number( apply_filters( 'gform_pagination_event_value', $event_value, $form, $source_page_number, $current_page_number ) ) ) );
|
106 |
|
@@ -189,7 +215,14 @@ class GFGAET_Pagination {
|
|
189 |
* @param int $source_page_number Source page number
|
190 |
* @param int $current_page_number Current Page Number
|
191 |
*/
|
192 |
-
$event_category =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
/**
|
195 |
* Filter: gform_pagination_event_action
|
@@ -203,7 +236,14 @@ class GFGAET_Pagination {
|
|
203 |
* @param int $source_page_number Source page number
|
204 |
* @param int $current_page_number Current Page Number
|
205 |
*/
|
206 |
-
$event_action =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
/**
|
209 |
* Filter: gform_pagination_event_label
|
@@ -218,6 +258,12 @@ class GFGAET_Pagination {
|
|
218 |
* @param int $current_page_number Current Page Number
|
219 |
*/
|
220 |
$event_label = sprintf( '%s::%d::%d', esc_html( $form['title'] ), absint( $source_page_number ), absint( $current_page_number ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
$event_label = apply_filters( 'gform_pagination_event_label', $event_label, $form, $source_page_number, $current_page_number );
|
222 |
|
223 |
/**
|
@@ -233,8 +279,12 @@ class GFGAET_Pagination {
|
|
233 |
* @param int $current_page_number Current Page Number
|
234 |
*/
|
235 |
$event_value = 0;
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
238 |
if ( 0 !== $event_value ) {
|
239 |
$event->set_matomo_event_value( $event_value );
|
240 |
}
|
57 |
* @param int $source_page_number Source page number
|
58 |
* @param int $current_page_number Current Page Number
|
59 |
*/
|
60 |
+
$event_category = 'form';
|
61 |
+
if ( isset( $form['pagination_category'] ) ) {
|
62 |
+
$pagination_category = trim( $form['pagination_category'] );
|
63 |
+
if( ! empty( $pagination_category ) ) {
|
64 |
+
$event_category = $pagination_category;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
$event_category = apply_filters( 'gform_pagination_event_category', $event_category, $form, $source_page_number, $current_page_number );
|
68 |
|
69 |
/**
|
70 |
* Filter: gform_pagination_event_action
|
78 |
* @param int $source_page_number Source page number
|
79 |
* @param int $current_page_number Current Page Number
|
80 |
*/
|
81 |
+
$event_action = 'pagination';
|
82 |
+
if ( isset( $form['pagination_action'] ) ) {
|
83 |
+
$pagination_action = trim( $form['pagination_action'] );
|
84 |
+
if( ! empty( $pagination_action ) ) {
|
85 |
+
$event_action = $pagination_action;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
$event_action = apply_filters( 'gform_pagination_event_action', $event_action, $form, $source_page_number, $current_page_number );
|
89 |
|
90 |
/**
|
91 |
* Filter: gform_pagination_event_label
|
100 |
* @param int $current_page_number Current Page Number
|
101 |
*/
|
102 |
$event_label = sprintf( '%s::%d::%d', esc_html( $form['title'] ), absint( $source_page_number ), absint( $current_page_number ) );
|
103 |
+
if ( isset( $form['pagination_label'] ) ) {
|
104 |
+
$pagination_label = trim( $form['pagination_label'] );
|
105 |
+
if( ! empty( $pagination_label ) ) {
|
106 |
+
$event_label = $pagination_label;
|
107 |
+
}
|
108 |
+
}
|
109 |
$event_label = apply_filters( 'gform_pagination_event_label', $event_label, $form, $source_page_number, $current_page_number );
|
110 |
|
111 |
/**
|
121 |
* @param int $current_page_number Current Page Number
|
122 |
*/
|
123 |
$event_value = 0;
|
124 |
+
if ( isset( $form['pagination_value'] ) ) {
|
125 |
+
$pagination_value = trim( $form['pagination_value'] );
|
126 |
+
if( ! empty( $pagination_value ) ) {
|
127 |
+
$event_value = $pagination_value;
|
128 |
+
}
|
129 |
+
}
|
130 |
// Value is rounded up (Google likes integers only) before given an absolute value
|
131 |
$event_value = absint( round( GFCommon::to_number( apply_filters( 'gform_pagination_event_value', $event_value, $form, $source_page_number, $current_page_number ) ) ) );
|
132 |
|
215 |
* @param int $source_page_number Source page number
|
216 |
* @param int $current_page_number Current Page Number
|
217 |
*/
|
218 |
+
$event_category = 'form';
|
219 |
+
if ( isset( $form['pagination_category'] ) ) {
|
220 |
+
$pagination_category = trim( $form['pagination_category'] );
|
221 |
+
if( ! empty( $pagination_category ) ) {
|
222 |
+
$event_category = $pagination_category;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
$event_category = apply_filters( 'gform_pagination_event_category', $event_category, $form, $source_page_number, $current_page_number );
|
226 |
|
227 |
/**
|
228 |
* Filter: gform_pagination_event_action
|
236 |
* @param int $source_page_number Source page number
|
237 |
* @param int $current_page_number Current Page Number
|
238 |
*/
|
239 |
+
$event_action = 'pagination';
|
240 |
+
if ( isset( $form['pagination_action'] ) ) {
|
241 |
+
$pagination_action = trim( $form['pagination_action'] );
|
242 |
+
if( ! empty( $pagination_action ) ) {
|
243 |
+
$event_action = $pagination_action;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
$event_action = apply_filters( 'gform_pagination_event_action', $event_action, $form, $source_page_number, $current_page_number );
|
247 |
|
248 |
/**
|
249 |
* Filter: gform_pagination_event_label
|
258 |
* @param int $current_page_number Current Page Number
|
259 |
*/
|
260 |
$event_label = sprintf( '%s::%d::%d', esc_html( $form['title'] ), absint( $source_page_number ), absint( $current_page_number ) );
|
261 |
+
if ( isset( $form['pagination_label'] ) ) {
|
262 |
+
$pagination_label = trim( $form['pagination_label'] );
|
263 |
+
if( ! empty( $pagination_label ) ) {
|
264 |
+
$event_label = $pagination_label;
|
265 |
+
}
|
266 |
+
}
|
267 |
$event_label = apply_filters( 'gform_pagination_event_label', $event_label, $form, $source_page_number, $current_page_number );
|
268 |
|
269 |
/**
|
279 |
* @param int $current_page_number Current Page Number
|
280 |
*/
|
281 |
$event_value = 0;
|
282 |
+
if ( isset( $form['pagination_value'] ) ) {
|
283 |
+
$pagination_value = trim( $form['pagination_value'] );
|
284 |
+
if( ! empty( $pagination_value ) ) {
|
285 |
+
$event_value = $pagination_value;
|
286 |
+
}
|
287 |
+
}
|
288 |
if ( 0 !== $event_value ) {
|
289 |
$event->set_matomo_event_value( $event_value );
|
290 |
}
|
includes/GFGAET_Pagination_Settings.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
GFForms::include_addon_framework();
|
3 |
+
class GFGAET_Pagination_Settings extends GFAddOn {
|
4 |
+
protected $_version = '2.0';
|
5 |
+
protected $_min_gravityforms_version = '1.8.20';
|
6 |
+
protected $_slug = 'GFGAET_Pagination_Settings';
|
7 |
+
protected $_path = 'gravity-forms-google-analytics-event-tracking/gravity-forms-event-tracking.php';
|
8 |
+
protected $_full_path = __FILE__;
|
9 |
+
protected $_title = 'Gravity Forms Google Analytics Event Tracking';
|
10 |
+
protected $_short_title = 'Event Tracking';
|
11 |
+
// Members plugin integration
|
12 |
+
protected $_capabilities = array( 'gravityforms_event_tracking', 'gravityforms_event_tracking_uninstall' );
|
13 |
+
// Permissions
|
14 |
+
protected $_capabilities_settings_page = 'gravityforms_event_tracking';
|
15 |
+
protected $_capabilities_form_settings = 'gravityforms_event_tracking';
|
16 |
+
protected $_capabilities_uninstall = 'gravityforms_event_tracking_uninstall';
|
17 |
+
|
18 |
+
private static $_instance = null;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Returns an instance of this class, and stores it in the $_instance property.
|
22 |
+
*
|
23 |
+
* @return object $_instance An instance of this class.
|
24 |
+
*/
|
25 |
+
public static function get_instance() {
|
26 |
+
if ( self::$_instance == null ) {
|
27 |
+
self::$_instance = new self();
|
28 |
+
}
|
29 |
+
|
30 |
+
return self::$_instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function init() {
|
34 |
+
parent::init();
|
35 |
+
|
36 |
+
add_filter( 'gform_form_settings', array( $this, 'add_pagination_form_settings' ), 10, 2 );
|
37 |
+
add_filter( 'gform_pre_form_settings_save', array( $this, 'save_pagination_settings' ), 10, 1 );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Save pagination settings.
|
42 |
+
*
|
43 |
+
* @since 2.3.5
|
44 |
+
*
|
45 |
+
* @param array $form The form
|
46 |
+
*
|
47 |
+
* @return array Updated form values
|
48 |
+
*/
|
49 |
+
public function save_pagination_settings( $form ) {
|
50 |
+
$form['pagination_category'] = rgpost( 'pagination_category' );
|
51 |
+
$form['pagination_action'] = rgpost( 'pagination_action' );
|
52 |
+
$form['pagination_label'] = rgpost( 'pagination_label' );
|
53 |
+
$form['pagination_value'] = rgpost( 'pagination_value' );
|
54 |
+
return $form;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Add pagination form settings to Gravity Forms.
|
59 |
+
*
|
60 |
+
* @since 2.3.5
|
61 |
+
*
|
62 |
+
* @param array $settings The form settings
|
63 |
+
* @param array $form The form
|
64 |
+
*
|
65 |
+
* @return array Updated form settings
|
66 |
+
*/
|
67 |
+
public function add_pagination_form_settings( $settings, $form ) {
|
68 |
+
$settings[ __( 'Pagination Event Tracking', 'gravity-forms-google-analytics-event-tracking' ) ]['pagination_description'] = sprintf( '
|
69 |
+
<tr>
|
70 |
+
<th colspan="2">
|
71 |
+
%s<br /><br />
|
72 |
+
<strong>%s:</strong> form<br />
|
73 |
+
<strong>%s:</strong> pagination<br />
|
74 |
+
<strong>%s:</strong> %s<br />
|
75 |
+
<strong>%s:</strong> 0
|
76 |
+
</th>
|
77 |
+
</tr>', __( 'If left blank, the following values are used:', 'gravity-forms-google-analytics-event-tracking' ), __( 'Category', 'gravity-forms-google-analytics-event-tracking' ), __( 'Action', 'gravity-forms-google-analytics-event-tracking' ), __( 'Label', 'gravity-forms-google-analytics-event-tracking' ), __( '{form title}::{source page number}::{current page number}', 'gravity-forms-google-analytics-event-tracking' ), __( 'Value', 'gravity-forms-google-analytics-event-tracking' ) );
|
78 |
+
$settings[ __( 'Pagination Event Tracking', 'gravity-forms-google-analytics-event-tracking' ) ]['pagination_category'] = sprintf( '
|
79 |
+
<tr>
|
80 |
+
<th><label for="pagination_category">%s</label></th>
|
81 |
+
<td><input value="%s" name="pagination_category" id="pagination_category" class="fieldwidth-3" /></td>
|
82 |
+
</tr>', __( 'Pagination Category', 'gravity-forms-google-analytics-event-tracking' ), esc_attr( rgar( $form, 'pagination_category' ) ) );
|
83 |
+
$settings[ __( 'Pagination Event Tracking', 'gravity-forms-google-analytics-event-tracking' ) ]['pagination_action'] = sprintf( '
|
84 |
+
<tr>
|
85 |
+
<th><label for="pagination_action">%s</label></th>
|
86 |
+
<td><input value="%s" name="pagination_action" id="pagination_action" class="fieldwidth-3" /></td>
|
87 |
+
</tr>', __( 'Pagination Action', 'gravity-forms-google-analytics-event-tracking' ), esc_attr( rgar( $form, 'pagination_action' ) ) );
|
88 |
+
$settings[ __( 'Pagination Event Tracking', 'gravity-forms-google-analytics-event-tracking' ) ]['pagination_label'] = sprintf( '
|
89 |
+
<tr>
|
90 |
+
<th><label for="pagination_label">%s</label></th>
|
91 |
+
<td><input value="%s" name="pagination_label" id="pagination_label" class="fieldwidth-3" /></td>
|
92 |
+
</tr>', __( 'Pagination Label', 'gravity-forms-google-analytics-event-tracking' ), esc_attr( rgar( $form, 'pagination_label' ) ) );
|
93 |
+
$settings[ __( 'Pagination Event Tracking', 'gravity-forms-google-analytics-event-tracking' ) ]['pagination_value'] = sprintf( '
|
94 |
+
<tr>
|
95 |
+
<th><label for="pagination_value">%s</label></th>
|
96 |
+
<td><input value="%s" type="number" name="pagination_value" id="pagination_value" class="fieldwidth-3" /></td>
|
97 |
+
</tr>', __( 'Pagination Value', 'gravity-forms-google-analytics-event-tracking' ), esc_attr( rgar( $form, 'pagination_value' ) ) );
|
98 |
+
return $settings;
|
99 |
+
}
|
100 |
+
}
|
includes/GFGAET_Partial_Entries.php
CHANGED
@@ -130,13 +130,13 @@ class GFGAET_Partial_Entries extends GFAddOn {
|
|
130 |
*
|
131 |
* @since 2.3.0
|
132 |
*
|
133 |
-
* @param
|
134 |
* @param array $form Gravity Form form array
|
135 |
* @param array $partial_entry Gravity Form Partial Entry array
|
136 |
* @param string $value Gravity Forms Field value
|
137 |
* @param string label Label of the form entry
|
138 |
*/
|
139 |
-
$event_value = apply_filters( 'gform_partial_event_value', $event_value, $form, $partial_entry, $value, $label );
|
140 |
|
141 |
// Let's set up the measurement protocol
|
142 |
$ua_code = GFGAET::get_ua_code();
|
130 |
*
|
131 |
* @since 2.3.0
|
132 |
*
|
133 |
+
* @param int $event_value Event value
|
134 |
* @param array $form Gravity Form form array
|
135 |
* @param array $partial_entry Gravity Form Partial Entry array
|
136 |
* @param string $value Gravity Forms Field value
|
137 |
* @param string label Label of the form entry
|
138 |
*/
|
139 |
+
$event_value = absint( round( GFCommon::to_number( apply_filters( 'gform_partial_event_value', $event_value, $form, $partial_entry, $value, $label ) ) ) );
|
140 |
|
141 |
// Let's set up the measurement protocol
|
142 |
$ua_code = GFGAET::get_ua_code();
|
includes/GFGAET_Submission_Feeds.php
CHANGED
@@ -395,7 +395,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
|
|
395 |
if ( typeof( console ) == 'object' ) {
|
396 |
console.log( 'send command' );
|
397 |
console.log( ga_send );
|
398 |
-
console.log( <?php echo $event_value; ?> );
|
399 |
}
|
400 |
|
401 |
// Use that tracker
|
395 |
if ( typeof( console ) == 'object' ) {
|
396 |
console.log( 'send command' );
|
397 |
console.log( ga_send );
|
398 |
+
console.log( '<?php echo $event_value; ?>' );
|
399 |
}
|
400 |
|
401 |
// Use that tracker
|
includes/GFGAET_Tag_Manager.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class GFGAET_Tag_Manager {
|
3 |
-
/**
|
4 |
-
* Holds the class instance.
|
5 |
-
*
|
6 |
-
* @since 2.0.0
|
7 |
-
* @access private
|
8 |
-
*/
|
9 |
-
private static $instance = null;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Retrieve a class instance.
|
13 |
-
*
|
14 |
-
* @since 2.0.0
|
15 |
-
*/
|
16 |
-
public static function get_instance() {
|
17 |
-
if ( null == self::$instance ) {
|
18 |
-
self::$instance = new self;
|
19 |
-
}
|
20 |
-
return self::$instance;
|
21 |
-
} //end get_instance
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Class constructor.
|
25 |
-
*
|
26 |
-
* @since 2.0.0
|
27 |
-
*/
|
28 |
-
private function __construct() {
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Initialize the tag manager push.
|
34 |
-
*
|
35 |
-
* @since 2.0.0
|
36 |
-
*
|
37 |
-
* @param array $entry The entry array
|
38 |
-
* @param array $form The form array
|
39 |
-
*/
|
40 |
-
public function send( $entry, $form ) {
|
41 |
-
if ( GFGAET::is_js_only() ) {
|
42 |
-
?>
|
43 |
-
<script>
|
44 |
-
var form_submission = sessionStorage.getItem('entry_<?php echo absint( $entry[ 'id' ] ); ?>');
|
45 |
-
if ( null == form_submission ) {
|
46 |
-
if ( typeof( dataLayer ) != 'undefined' ) {
|
47 |
-
dataLayer.push({'event': 'GFTrackEvent',
|
48 |
-
'GFTrackCategory':'form',
|
49 |
-
'GFTrackAction':'submission',
|
50 |
-
'GFTrackLabel':'{{<?php echo esc_js( $form['title'] ); ?>}}::{{<?php echo esc_js( $entry['id'] ); ?>}}',
|
51 |
-
'GFEntryData':<?php echo json_encode( $entry ); ?>
|
52 |
-
});
|
53 |
-
sessionStorage.setItem("entry_<?php echo absint( $entry[ 'id' ] ); ?>", "true");
|
54 |
-
}
|
55 |
-
}
|
56 |
-
</script>
|
57 |
-
<?php
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|