Event Tracking for Gravity Forms - Version 2.0.5

Version Description

  • Released 2017-10-17
  • Bug fix: events were not being sent using the measurement protocol
  • Bug fix: fixing various conflicts with PHP7.
Download this release

Release Info

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

Code changes from version 2.0.3 to 2.0.5

Files changed (27) hide show
  1. LICENSE.txt +0 -0
  2. README.txt +13 -5
  3. gravity-forms-event-tracking.php +12 -12
  4. includes/GFGAET_Measurement_Protocol.php +150 -0
  5. includes/GFGAET_Pagination.php +17 -24
  6. includes/GFGAET_Submission_Feeds.php +49 -55
  7. includes/GFGAET_Tag_Manager.php +0 -0
  8. includes/GFGAET_UA.php +0 -0
  9. includes/vendor/ga-mp/src/Racecore/GATracking/Autoloader.php +0 -74
  10. includes/vendor/ga-mp/src/Racecore/GATracking/Exception.php +0 -22
  11. includes/vendor/ga-mp/src/Racecore/GATracking/Exception/EndpointServerException.php +0 -24
  12. includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingConfigurationException.php +0 -24
  13. includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingTrackingParameterException.php +0 -24
  14. includes/vendor/ga-mp/src/Racecore/GATracking/GATracking.php +0 -477
  15. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/AbstractTracking.php +0 -685
  16. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php +0 -24
  17. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php +0 -35
  18. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php +0 -225
  19. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php +0 -194
  20. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php +0 -148
  21. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php +0 -85
  22. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php +0 -33
  23. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php +0 -125
  24. includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php +0 -250
  25. index.php +0 -0
  26. languages/gravity-forms-google-analytics-event-tracking.pot +0 -0
  27. languages/index.php +0 -0
LICENSE.txt CHANGED
File without changes
README.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Gravity Forms Google Analytics Event Tracking ===
2
- Contributors: nmarks, ronalfy, bigwing
3
  Tags: gravity forms, google analytics, google tag manager, event tracking
4
  Requires at least:4.0
5
  Tested up to: 4.8
6
- Stable tag: 2.0.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -98,6 +98,11 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
101
  = 2.0.3 =
102
  * Released 2016-09-24
103
  * Bug fix: Conflict with role management plugins
@@ -126,7 +131,7 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
126
  * Bug Fix: Plugin will now trigger events if a UA code is set in the feed but not in the settings
127
  * Enhancement: Document Path will now be set as part of event creation
128
  * Enhancement: Measurement protocol updated
129
- * Enhancement: Measurement protocol will not detect SSL and use the appropriate protocol
130
 
131
  = 1.6.5 =
132
  * Released 2015-12-11
@@ -195,7 +200,10 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
195
 
196
  == Upgrade Notice ==
197
 
198
- = 2.0.3 =
 
 
 
199
  Numerous enhancements, including pagination tracking. See the Changelog for more information.
200
 
201
  = 2.0.1 =
@@ -214,4 +222,4 @@ Updates to measurement protocol. Friendly notices for incompatible PHP versions
214
  Ability to add multiple UA codes in the feed settings
215
 
216
  = 1.6.4 =
217
- WordPress 4.3 compatibility and better internationalization.
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.8
6
+ Stable tag: 2.0.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
98
 
99
  == Changelog ==
100
 
101
+ = 2.0.5 =
102
+ * Released 2017-10-17
103
+ * Bug fix: events were not being sent using the measurement protocol
104
+ * Bug fix: fixing various conflicts with PHP7.
105
+
106
  = 2.0.3 =
107
  * Released 2016-09-24
108
  * Bug fix: Conflict with role management plugins
131
  * Bug Fix: Plugin will now trigger events if a UA code is set in the feed but not in the settings
132
  * Enhancement: Document Path will now be set as part of event creation
133
  * Enhancement: Measurement protocol updated
134
+ * Enhancement: Measurement protocol will not detect SSL and use the appropriate protocol
135
 
136
  = 1.6.5 =
137
  * Released 2015-12-11
200
 
201
  == Upgrade Notice ==
202
 
203
+ = 2.0.5 =
204
+ A fix to the measurement protocol. Please verify your conversions.
205
+
206
+ = 2.0.3 =
207
  Numerous enhancements, including pagination tracking. See the Changelog for more information.
208
 
209
  = 2.0.1 =
222
  Ability to add multiple UA codes in the feed settings
223
 
224
  = 1.6.4 =
225
+ WordPress 4.3 compatibility and better internationalization.
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.3
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
@@ -47,9 +47,9 @@ class GFGAET {
47
  */
48
  private function __construct() {
49
  load_plugin_textdomain( 'gravity-forms-google-analytics-event-tracking', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
50
-
51
  spl_autoload_register( array( $this, 'loader' ) );
52
-
53
  add_action( 'gform_loaded', array( $this, 'gforms_loaded' ) );
54
  }
55
 
@@ -87,7 +87,7 @@ class GFGAET {
87
  * @return string plugin basename
88
  */
89
  public static function get_plugin_basename() {
90
- return plugin_basename( __FILE__ );
91
  }
92
 
93
  /**
@@ -103,7 +103,7 @@ class GFGAET {
103
  $dir = rtrim( plugin_dir_path(__FILE__), '/' );
104
  if ( !empty( $path ) && is_string( $path) )
105
  $dir .= '/' . ltrim( $path, '/' );
106
- return $dir;
107
  }
108
 
109
  /**
@@ -123,20 +123,20 @@ class GFGAET {
123
 
124
  // Initialize pagination
125
  add_action( 'gform_post_paging', array( $this, 'pagination'), 10, 3 );
126
-
127
  // Initialize whether Ajax is on or off
128
  add_filter( 'gform_form_args', array( $this, 'maybe_ajax_only' ), 15, 1 );
129
  }
130
-
131
  /**
132
  * Get the Google Analytics UA Code
133
- *
134
  * @since 2.0.0
135
  * @return string/bool Returns string UA code, false otherwise
136
  */
137
  public static function get_ua_code() {
138
  $gravity_forms_add_on_settings = get_option( 'gravityformsaddon_GFGAET_UA_settings', array() );
139
-
140
  $ua_id = isset( $gravity_forms_add_on_settings[ 'gravity_forms_event_tracking_ua' ] ) ? $gravity_forms_add_on_settings[ 'gravity_forms_event_tracking_ua' ] : false;
141
 
142
  $ua_regex = "/^UA-[0-9]{5,}-[0-9]{1,}$/";
@@ -164,7 +164,7 @@ class GFGAET {
164
  }
165
  return false;
166
  }
167
-
168
  /**
169
  * Checks whether Tag Manager only mode is activated for sending events.
170
  *
@@ -228,8 +228,8 @@ class GFGAET {
228
  public function pagination( $form, $source_page_number, $current_page_number ) {
229
  $pagination = GFGAET_Pagination::get_instance();
230
  $pagination->paginate( $form, $source_page_number, $current_page_number );
231
- }
232
  }
233
 
234
  register_activation_hook( __FILE__, array( 'GFGAET', 'check_plugin' ) );
235
- GFGAET::get_instance();
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.5
7
  * Author: Ronald Huereca
8
  * Author URI: https://mediaron.com
9
  * Text Domain: gravity-forms-google-analytics-event-tracking
47
  */
48
  private function __construct() {
49
  load_plugin_textdomain( 'gravity-forms-google-analytics-event-tracking', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
50
+
51
  spl_autoload_register( array( $this, 'loader' ) );
52
+
53
  add_action( 'gform_loaded', array( $this, 'gforms_loaded' ) );
54
  }
55
 
87
  * @return string plugin basename
88
  */
89
  public static function get_plugin_basename() {
90
+ return plugin_basename( __FILE__ );
91
  }
92
 
93
  /**
103
  $dir = rtrim( plugin_dir_path(__FILE__), '/' );
104
  if ( !empty( $path ) && is_string( $path) )
105
  $dir .= '/' . ltrim( $path, '/' );
106
+ return $dir;
107
  }
108
 
109
  /**
123
 
124
  // Initialize pagination
125
  add_action( 'gform_post_paging', array( $this, 'pagination'), 10, 3 );
126
+
127
  // Initialize whether Ajax is on or off
128
  add_filter( 'gform_form_args', array( $this, 'maybe_ajax_only' ), 15, 1 );
129
  }
130
+
131
  /**
132
  * Get the Google Analytics UA Code
133
+ *
134
  * @since 2.0.0
135
  * @return string/bool Returns string UA code, false otherwise
136
  */
137
  public static function get_ua_code() {
138
  $gravity_forms_add_on_settings = get_option( 'gravityformsaddon_GFGAET_UA_settings', array() );
139
+
140
  $ua_id = isset( $gravity_forms_add_on_settings[ 'gravity_forms_event_tracking_ua' ] ) ? $gravity_forms_add_on_settings[ 'gravity_forms_event_tracking_ua' ] : false;
141
 
142
  $ua_regex = "/^UA-[0-9]{5,}-[0-9]{1,}$/";
164
  }
165
  return false;
166
  }
167
+
168
  /**
169
  * Checks whether Tag Manager only mode is activated for sending events.
170
  *
228
  public function pagination( $form, $source_page_number, $current_page_number ) {
229
  $pagination = GFGAET_Pagination::get_instance();
230
  $pagination->paginate( $form, $source_page_number, $current_page_number );
231
+ }
232
  }
233
 
234
  register_activation_hook( __FILE__, array( 'GFGAET', 'check_plugin' ) );
235
+ GFGAET::get_instance();
includes/GFGAET_Measurement_Protocol.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class GFGAET_Measurement_Protocol {
3
+
4
+ private $endpoint = 'https://www.google-analytics.com/collect'; // Measurement Protocol Endpoint
5
+ private $cid = ''; // Client ID
6
+ private $tid = ''; // Tracking ID (UA-XXXX-YY)
7
+ private $v = 1; // Protocol Version
8
+ private $t = 'event'; //hit type
9
+ private $ec = ''; // event category
10
+ private $ea = ''; // Event action
11
+ private $el = ''; // Event Label
12
+ private $ev = ''; // Event Value
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();
19
+ }
20
+
21
+ public function set_event_category( $event_category ) {
22
+ $this->ec = $event_category;
23
+ }
24
+
25
+ public function set_event_action( $event_action ) {
26
+ $this->ea = $event_action;
27
+ }
28
+
29
+ public function set_event_label( $event_label ) {
30
+ $this->el = $event_label;
31
+ }
32
+
33
+ public function set_event_value( $event_value ) {
34
+ $this->ev = $event_value;
35
+ }
36
+
37
+ public function set_document_path( $document_path ) {
38
+ $this->dp = $document_path;
39
+ }
40
+
41
+ public function set_document_location( $document_location ) {
42
+ $this->dl = $document_location;
43
+ }
44
+
45
+ public function set_document_title( $document_title ) {
46
+ $this->dt = $document_title;
47
+ }
48
+
49
+ public function send( $ua_code ) {
50
+
51
+ // Get variables in wp_remote_post body format
52
+ $mp_vars = array(
53
+ 'cid',
54
+ 'v',
55
+ 't',
56
+ 'ec',
57
+ 'ea',
58
+ 'el',
59
+ 'ev',
60
+ 'dp',
61
+ 'dl',
62
+ 'dt',
63
+ );
64
+ $mp_body = array(
65
+ 'tid' => $ua_code,
66
+ );
67
+ foreach( $mp_vars as $index => $mp_var ) {
68
+ if ( empty( $this->{$mp_vars[$index]} ) ) continue; // Empty params cause the payload to fail in testing
69
+ $mp_body[$mp_var] = $this->{$mp_vars[$index]};
70
+ }
71
+
72
+ // Add Payload
73
+ $payload = add_query_arg( $mp_body, $this->endpoint );
74
+
75
+ // Perform the POST
76
+ $response = wp_safe_remote_get( $payload );
77
+ }
78
+
79
+
80
+ /**
81
+ * Create a GUID on Client specific values
82
+ *
83
+ * @return string
84
+ */
85
+ private function create_client_id() {
86
+
87
+ // collect user specific data
88
+ if ( isset( $_COOKIE['_ga'] ) ) {
89
+
90
+ $ga_cookie = explode( '.', $_COOKIE['_ga'] );
91
+ if( isset( $ga_cookie[2] ) ) {
92
+
93
+ // check if uuid
94
+ if( $this->check_UUID( $ga_cookie[2] ) ) {
95
+
96
+ // uuid set in cookie
97
+ return $ga_cookie[2];
98
+ }
99
+ elseif( isset( $ga_cookie[2]) && isset( $ga_cookie[3] ) ) {
100
+
101
+ // google default client id
102
+ return $ga_cookie[2] . '.' . $ga_cookie[3];
103
+ }
104
+ }
105
+ }
106
+
107
+ // nothing found - return random uuid client id
108
+ return $this->generate_UUID();
109
+ }
110
+
111
+ /**
112
+ * Check if is a valid UUID v4
113
+ *
114
+ * @param $uuid
115
+ * @return int
116
+ */
117
+ private function check_UUID( $uuid ) {
118
+ return preg_match('#^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$#i', $uuid );
119
+ }
120
+
121
+ /**
122
+ * Generate UUID v4 function - needed to generate a CID when one isn't available
123
+ *
124
+ * @author Andrew Moore http://www.php.net/manual/en/function.uniqid.php#94959
125
+ * @return string
126
+ */
127
+ private function generate_UUID() {
128
+ return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
129
+ // 32 bits for "time_low"
130
+ mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
131
+
132
+ // 16 bits for "time_mid"
133
+ mt_rand( 0, 0xffff ),
134
+
135
+ // 16 bits for "time_hi_and_version",
136
+ // four most significant bits holds version number 4
137
+ mt_rand( 0, 0x0fff ) | 0x4000,
138
+
139
+ // 16 bits, 8 bits for "clk_seq_hi_res",
140
+ // 8 bits for "clk_seq_low",
141
+ // two most significant bits holds zero and one for variant DCE1.1
142
+ mt_rand( 0, 0x3fff ) | 0x8000,
143
+
144
+ // 48 bits for "node"
145
+ mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
146
+ );
147
+ }
148
+ }
149
+
150
+ ?>
includes/GFGAET_Pagination.php CHANGED
@@ -7,7 +7,7 @@ class GFGAET_Pagination {
7
  * @access private
8
  */
9
  private static $instance = null;
10
-
11
  /**
12
  * Retrieve a class instance.
13
  *
@@ -19,7 +19,7 @@ class GFGAET_Pagination {
19
  }
20
  return self::$instance;
21
  } //end get_instance
22
-
23
  /**
24
  * Class constructor.
25
  *
@@ -28,7 +28,7 @@ class GFGAET_Pagination {
28
  private function __construct() {
29
 
30
  }
31
-
32
  /**
33
  * Send pagination events.
34
  *
@@ -39,13 +39,12 @@ class GFGAET_Pagination {
39
  * @param int $current_page_number The new page number
40
  */
41
  public function paginate( $form, $source_page_number, $current_page_number ) {
42
- require_once( 'vendor/ga-mp/src/Racecore/GATracking/Autoloader.php');
43
- Racecore\GATracking\Autoloader::register( dirname(__FILE__) . '/vendor/ga-mp/src/' );
44
-
45
  $ua_code = GFGAET::get_ua_code();
46
  if ( false !== $ua_code ) {
47
- $event = new \Racecore\GATracking\Tracking\Event();
48
-
 
49
  /**
50
  * Filter: gform_pagination_event_category
51
  *
@@ -88,12 +87,11 @@ class GFGAET_Pagination {
88
  */
89
  $event_label = sprintf( '%s::%d::%d', esc_html( $form['title'] ), absint( $source_page_number ), absint( $current_page_number ) );
90
  $event_label = apply_filters( 'gform_pagination_event_label', $event_label, $form, $source_page_number, $current_page_number );
91
-
92
- // Set the event meta
93
- $event->setEventCategory( $event_category );
94
- $event->setEventAction( $event_action );
95
- $event->setEventLabel( $event_label );
96
-
97
  if ( GFGAET::is_ga_only() ) {
98
  ?>
99
  <script>
@@ -109,7 +107,7 @@ class GFGAET_Pagination {
109
  window.parent.ga(function(tracker) {
110
  default_ua_code = tracker.get('trackingId');
111
  });
112
-
113
  // If UA code matches, use that tracker
114
  if ( default_ua_code == '<?php echo esc_js( $ua_code ); ?>' ) {
115
  window.parent.ga( 'send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>' );
@@ -136,15 +134,10 @@ class GFGAET_Pagination {
136
  <?php
137
  return;
138
  }
139
-
140
  // Submit the event
141
- $tracking = new \Racecore\GATracking\GATracking( $ua_code );
142
- try {
143
- $tracking->sendTracking( $event );
144
- } catch (Exception $e) {
145
- error_log( $e->getMessage() . ' in ' . get_class( $e ) );
146
- }
147
  }
148
-
149
  }
150
- }
7
  * @access private
8
  */
9
  private static $instance = null;
10
+
11
  /**
12
  * Retrieve a class instance.
13
  *
19
  }
20
  return self::$instance;
21
  } //end get_instance
22
+
23
  /**
24
  * Class constructor.
25
  *
28
  private function __construct() {
29
 
30
  }
31
+
32
  /**
33
  * Send pagination events.
34
  *
39
  * @param int $current_page_number The new page number
40
  */
41
  public function paginate( $form, $source_page_number, $current_page_number ) {
42
+
 
 
43
  $ua_code = GFGAET::get_ua_code();
44
  if ( false !== $ua_code ) {
45
+ $event = new GFGAET_Measurement_Protocol();
46
+ $event->init();
47
+
48
  /**
49
  * Filter: gform_pagination_event_category
50
  *
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
+ $event->set_event_category( $event_category );
92
+ $event->set_event_action( $event_action );
93
+ $event->set_event_label( $event_label );
94
+
 
95
  if ( GFGAET::is_ga_only() ) {
96
  ?>
97
  <script>
107
  window.parent.ga(function(tracker) {
108
  default_ua_code = tracker.get('trackingId');
109
  });
110
+
111
  // If UA code matches, use that tracker
112
  if ( default_ua_code == '<?php echo esc_js( $ua_code ); ?>' ) {
113
  window.parent.ga( 'send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>' );
134
  <?php
135
  return;
136
  }
137
+
138
  // Submit the event
139
+ $event->send( $ua_code );
 
 
 
 
 
140
  }
141
+
142
  }
143
+ }
includes/GFGAET_Submission_Feeds.php CHANGED
@@ -51,16 +51,13 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
51
 
52
  /**
53
  * Public facing init
54
- *
55
  * @since 2.0.0
56
  */
57
  public function init_frontend() {
58
 
59
  parent::init_frontend();
60
-
61
- require_once( 'vendor/ga-mp/src/Racecore/GATracking/Autoloader.php');
62
- Racecore\GATracking\Autoloader::register( dirname(__FILE__) . '/vendor/ga-mp/src/' );
63
-
64
  // IPN hook for paypal standard!
65
  if ( class_exists( 'GFPayPal' ) ) {
66
  add_action( 'gform_paypal_post_ipn', array( $this, 'paypal_track_form_post_ipn' ), 10, 2 );
@@ -78,7 +75,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
78
 
79
  $paypal_feeds = $this->get_feeds_by_slug( 'gravityformspaypal', $form['id'] );
80
  $has_paypal_feed = false;
81
-
82
  foreach ( $paypal_feeds as $paypal_feed ){
83
  if ( $paypal_feed['is_active'] && $this->is_feed_condition_met( $paypal_feed, $form, $entry ) ){
84
  $has_paypal_feed = true;
@@ -98,23 +95,23 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
98
 
99
  /**
100
  * Load UA Settings
101
- *
102
  * @since 1.4.0
103
  * @return bool Returns true if UA ID is loaded, false otherwise
104
  */
105
  private function load_ua_settings() {
106
 
107
  $this->ua_id = $ua_id = GFGAET::get_ua_code();
108
-
109
  if ( false !== $this->ua_id ) {
110
  return true;
111
  }
112
  return false;
113
  }
114
-
115
  /**
116
  * Load UA Settings
117
- *
118
  * @since 1.4.0
119
  * @return bool Returns true if UA ID is loaded, false otherwise
120
  */
@@ -123,7 +120,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
123
  if ( $this->ua_id == false ) {
124
  return '';
125
  } else {
126
- return $this->ua_id;
127
  }
128
  }
129
 
@@ -140,7 +137,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
140
  $ga_cookie = isset( $_COOKIE['_ga'] ) ? $_COOKIE['_ga'] : '';
141
 
142
  // Location
143
- $document_location = 'http' . ( isset( $_SERVER['HTTPS'] ) ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI'];
144
 
145
  // Title
146
  $document_title = isset( $post ) && get_the_title( $post ) ? get_the_title( $post ) : 'no title';
@@ -193,7 +190,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
193
 
194
  /**
195
  * Handle the form after submission before sending to the event push
196
- *
197
  * @since 1.4.0
198
  * @param array $entry Gravity Forms entry object
199
  * @param array $form Gravity Forms form object
@@ -213,7 +210,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
213
  $ga_event_data[ $var ] = GFCommon::replace_variables( $ga_event_data[ $var ], $form, $entry, false, false, true, 'text' );
214
  }
215
  }
216
-
217
 
218
  // Push the event to google
219
  $this->push_event( $entry, $form, $ga_event_data );
@@ -221,7 +218,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
221
 
222
  /**
223
  * Handle the IPN response for pushing the event
224
- *
225
  * @since 1.4.0
226
  * @param array $post_object global post array from the IPN
227
  * @param array $entry Gravity Forms entry object
@@ -245,7 +242,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
245
 
246
  /**
247
  * Push the Google Analytics Event!
248
- *
249
  * @since 1.4.0
250
  * @param array $event Gravity Forms event object
251
  * @param array $form Gravity Forms form object
@@ -268,15 +265,16 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
268
  */
269
  $google_analytics_codes = apply_filters( 'gform_ua_ids', $google_analytics_codes, $form, $entry );
270
 
271
- if ( !is_array( $google_analytics_codes ) || empty( $google_analytics_codes ) ) return;
272
 
273
- $event = new \Racecore\GATracking\Tracking\Event();
 
274
 
275
  // Set some defaults
276
- $event->setDocumentPath( str_replace( home_url(), '', $entry[ 'source_url' ] ) );
277
- $event->setDocumentLocation( $ga_event_data['document_location'] );
278
- $event->setDocumentTitle( $ga_event_data['document_title'] );
279
-
280
  // Set our event object variables
281
  /**
282
  * Filter: gform_event_category
@@ -290,7 +288,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
290
  * @param object $entry Gravity Form Entry Object
291
  */
292
  $event_category = apply_filters( 'gform_event_category', $ga_event_data['gaEventCategory'], $form, $entry );
293
- $event->setEventCategory( $event_category );
294
 
295
  /**
296
  * Filter: gform_event_action
@@ -304,7 +302,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
304
  * @param object $entry Gravity Form Entry Object
305
  */
306
  $event_action = apply_filters( 'gform_event_action', $ga_event_data['gaEventAction'], $form, $entry );
307
- $event->setEventAction( $event_action );
308
 
309
  /**
310
  * Filter: gform_event_label
@@ -318,7 +316,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
318
  * @param object $entry Gravity Form Entry Object
319
  */
320
  $event_label = apply_filters( 'gform_event_label', $ga_event_data['gaEventLabel'], $form, $entry );
321
- $event->setEventLabel( $event_label );
322
 
323
  /**
324
  * Filter: gform_event_value
@@ -334,12 +332,12 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
334
  if ( $event_value ) {
335
  // Event value must be a valid float!
336
  $event_value = GFCommon::to_number( $event_value );
337
- $event->setEventValue( $event_value );
338
  }
339
-
340
  $feed_id = absint( $ga_event_data[ 'feed_id' ] );
341
  $entry_id = $entry['id'];
342
-
343
  if ( GFGAET::is_ga_only() ) {
344
  $count = 1;
345
  ?>
@@ -355,13 +353,13 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
355
  }
356
  }
357
  if ( typeof window.parent.ga != 'undefined' ) {
358
-
359
  // Try to get original UA code from third-party plugins or tag manager
360
  var default_ua_code = null;
361
  window.parent.ga(function(tracker) {
362
  default_ua_code = tracker.get('trackingId');
363
  });
364
-
365
  // If UA code matches, use that tracker
366
  if ( default_ua_code == '<?php echo esc_js( $ua_code ); ?>' ) {
367
  window.parent.ga( 'send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>' );
@@ -370,14 +368,14 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
370
  window.parent.ga( 'create', '<?php echo esc_js( $ua_code ); ?>', 'auto', 'GTGAET_Tracker<?php echo absint( $count ); ?>' );
371
  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 ); ?>' );
372
  }
373
-
374
  sessionStorage.setItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>', true );
375
  }
376
  }
377
-
378
  <?php
379
  $count += 1;
380
- }
381
  ?>
382
  </script>
383
  <?php
@@ -404,19 +402,15 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
404
 
405
  //Push out the event to each UA code
406
  foreach( $google_analytics_codes as $ua_code ) {
407
-
408
- $tracking = new \Racecore\GATracking\GATracking( $ua_code );
409
- try {
410
- $tracking->sendTracking( $event );
411
- } catch (Exception $e) {
412
- error_log( $e->getMessage() . ' in ' . get_class( $e ) );
413
- }
414
- }// Init tracking object
415
  }
416
 
417
  /**
418
  * Get the event value for payment entries
419
- *
420
  * @since 1.4.0
421
  * @param array $event Gravity Forms event object
422
  * @return string/boolean Event value or false if not a payment form
@@ -435,14 +429,14 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
435
 
436
  /**
437
  * Form settings page title
438
- *
439
  * @since 1.5.0
440
  * @return string Form Settings Title
441
  */
442
  public function feed_settings_title() {
443
  return __( 'Submission Tracking Settings', 'gravity-forms-google-analytics-event-tracking' );
444
  }
445
-
446
  public function maybe_save_feed_settings( $feed_id, $form_id ) {
447
  if ( ! rgpost( 'gform-settings-save' ) ) {
448
  return $feed_id;
@@ -465,16 +459,16 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
465
 
466
  $is_valid = $this->validate_settings( $sections, $settings );
467
  $result = false;
468
-
469
  //Check for a valid UA code
470
  $feed_ua_code = isset( $settings[ 'gaEventUA' ] ) ? $settings[ 'gaEventUA' ] : '';
471
  $ua_codes = $this->get_ua_codes( $feed_ua_code, $this->get_ga_id() );
472
  if ( empty( $ua_codes ) ) {
473
  GFCommon::add_error_message( __( 'You must set a UA code for event tracking to work.', 'gravity-forms-google-analytics-event-tracking' ) );
474
  return $feed_id;
475
- }
476
-
477
-
478
  if ( $is_valid ) {
479
  $settings = $this->filter_settings( $sections, $settings );
480
  $feed_id = $this->save_feed_settings( $feed_id, $form_id, $settings );
@@ -489,10 +483,10 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
489
 
490
  return $feed_id;
491
  }
492
-
493
  /**
494
  * Return Google Analytics GA Codes
495
- *
496
  * @since 1.7.0
497
  * @return array Array of GA codes
498
  */
@@ -502,8 +496,8 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
502
  $ga_ua = explode( ',', $feed_ua );
503
  if ( is_array( $ga_ua ) ) {
504
  foreach( $ga_ua as &$value ) {
505
- $value = trim( $value );
506
- }
507
  }
508
  $google_analytics_codes = $ga_ua;
509
  }
@@ -516,7 +510,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
516
 
517
  /**
518
  * Form settings fields
519
- *
520
  * @since 1.5.0
521
  * @return array Array of form settings
522
  */
@@ -598,7 +592,7 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
598
 
599
  /**
600
  * Instruction field
601
- *
602
  * @since 1.5.0
603
  */
604
  public function single_setting_row_instruction_field(){
@@ -630,4 +624,4 @@ class GFGAET_Submission_Feeds extends GFFeedAddOn {
630
  );
631
  }
632
 
633
- }
51
 
52
  /**
53
  * Public facing init
54
+ *
55
  * @since 2.0.0
56
  */
57
  public function init_frontend() {
58
 
59
  parent::init_frontend();
60
+
 
 
 
61
  // IPN hook for paypal standard!
62
  if ( class_exists( 'GFPayPal' ) ) {
63
  add_action( 'gform_paypal_post_ipn', array( $this, 'paypal_track_form_post_ipn' ), 10, 2 );
75
 
76
  $paypal_feeds = $this->get_feeds_by_slug( 'gravityformspaypal', $form['id'] );
77
  $has_paypal_feed = false;
78
+
79
  foreach ( $paypal_feeds as $paypal_feed ){
80
  if ( $paypal_feed['is_active'] && $this->is_feed_condition_met( $paypal_feed, $form, $entry ) ){
81
  $has_paypal_feed = true;
95
 
96
  /**
97
  * Load UA Settings
98
+ *
99
  * @since 1.4.0
100
  * @return bool Returns true if UA ID is loaded, false otherwise
101
  */
102
  private function load_ua_settings() {
103
 
104
  $this->ua_id = $ua_id = GFGAET::get_ua_code();
105
+
106
  if ( false !== $this->ua_id ) {
107
  return true;
108
  }
109
  return false;
110
  }
111
+
112
  /**
113
  * Load UA Settings
114
+ *
115
  * @since 1.4.0
116
  * @return bool Returns true if UA ID is loaded, false otherwise
117
  */
120
  if ( $this->ua_id == false ) {
121
  return '';
122
  } else {
123
+ return $this->ua_id;
124
  }
125
  }
126
 
137
  $ga_cookie = isset( $_COOKIE['_ga'] ) ? $_COOKIE['_ga'] : '';
138
 
139
  // Location
140
+ $document_location = str_replace( home_url(), '', $entry[ 'source_url' ] );
141
 
142
  // Title
143
  $document_title = isset( $post ) && get_the_title( $post ) ? get_the_title( $post ) : 'no title';
190
 
191
  /**
192
  * Handle the form after submission before sending to the event push
193
+ *
194
  * @since 1.4.0
195
  * @param array $entry Gravity Forms entry object
196
  * @param array $form Gravity Forms form object
210
  $ga_event_data[ $var ] = GFCommon::replace_variables( $ga_event_data[ $var ], $form, $entry, false, false, true, 'text' );
211
  }
212
  }
213
+
214
 
215
  // Push the event to google
216
  $this->push_event( $entry, $form, $ga_event_data );
218
 
219
  /**
220
  * Handle the IPN response for pushing the event
221
+ *
222
  * @since 1.4.0
223
  * @param array $post_object global post array from the IPN
224
  * @param array $entry Gravity Forms entry object
242
 
243
  /**
244
  * Push the Google Analytics Event!
245
+ *
246
  * @since 1.4.0
247
  * @param array $event Gravity Forms event object
248
  * @param array $form Gravity Forms form object
265
  */
266
  $google_analytics_codes = apply_filters( 'gform_ua_ids', $google_analytics_codes, $form, $entry );
267
 
268
+ if ( !is_array( $google_analytics_codes ) || empty( $google_analytics_codes ) ) return;
269
 
270
+ $event = new GFGAET_Measurement_Protocol();
271
+ $event->init();
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
279
  /**
280
  * Filter: gform_event_category
288
  * @param object $entry Gravity Form Entry Object
289
  */
290
  $event_category = apply_filters( 'gform_event_category', $ga_event_data['gaEventCategory'], $form, $entry );
291
+ $event->set_event_category( $event_category );
292
 
293
  /**
294
  * Filter: gform_event_action
302
  * @param object $entry Gravity Form Entry Object
303
  */
304
  $event_action = apply_filters( 'gform_event_action', $ga_event_data['gaEventAction'], $form, $entry );
305
+ $event->set_event_action( $event_action );
306
 
307
  /**
308
  * Filter: gform_event_label
316
  * @param object $entry Gravity Form Entry Object
317
  */
318
  $event_label = apply_filters( 'gform_event_label', $ga_event_data['gaEventLabel'], $form, $entry );
319
+ $event->set_event_label( $event_label );
320
 
321
  /**
322
  * Filter: gform_event_value
332
  if ( $event_value ) {
333
  // Event value must be a valid float!
334
  $event_value = GFCommon::to_number( $event_value );
335
+ $event->set_event_value( $event_value );
336
  }
337
+
338
  $feed_id = absint( $ga_event_data[ 'feed_id' ] );
339
  $entry_id = $entry['id'];
340
+
341
  if ( GFGAET::is_ga_only() ) {
342
  $count = 1;
343
  ?>
353
  }
354
  }
355
  if ( typeof window.parent.ga != 'undefined' ) {
356
+
357
  // Try to get original UA code from third-party plugins or tag manager
358
  var default_ua_code = null;
359
  window.parent.ga(function(tracker) {
360
  default_ua_code = tracker.get('trackingId');
361
  });
362
+
363
  // If UA code matches, use that tracker
364
  if ( default_ua_code == '<?php echo esc_js( $ua_code ); ?>' ) {
365
  window.parent.ga( 'send', 'event', '<?php echo esc_js( $event_category ); ?>', '<?php echo esc_js( $event_action ); ?>', '<?php echo esc_js( $event_label ); ?>' );
368
  window.parent.ga( 'create', '<?php echo esc_js( $ua_code ); ?>', 'auto', 'GTGAET_Tracker<?php echo absint( $count ); ?>' );
369
  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 ); ?>' );
370
  }
371
+
372
  sessionStorage.setItem('feed_<?php echo absint( $feed_id ); ?>_entry_<?php echo absint( $entry[ 'id' ] ); ?>', true );
373
  }
374
  }
375
+
376
  <?php
377
  $count += 1;
378
+ }
379
  ?>
380
  </script>
381
  <?php
402
 
403
  //Push out the event to each UA code
404
  foreach( $google_analytics_codes as $ua_code ) {
405
+
406
+ // Submit the event
407
+ $event->send( $ua_code );
408
+ }
 
 
 
 
409
  }
410
 
411
  /**
412
  * Get the event value for payment entries
413
+ *
414
  * @since 1.4.0
415
  * @param array $event Gravity Forms event object
416
  * @return string/boolean Event value or false if not a payment form
429
 
430
  /**
431
  * Form settings page title
432
+ *
433
  * @since 1.5.0
434
  * @return string Form Settings Title
435
  */
436
  public function feed_settings_title() {
437
  return __( 'Submission Tracking Settings', 'gravity-forms-google-analytics-event-tracking' );
438
  }
439
+
440
  public function maybe_save_feed_settings( $feed_id, $form_id ) {
441
  if ( ! rgpost( 'gform-settings-save' ) ) {
442
  return $feed_id;
459
 
460
  $is_valid = $this->validate_settings( $sections, $settings );
461
  $result = false;
462
+
463
  //Check for a valid UA code
464
  $feed_ua_code = isset( $settings[ 'gaEventUA' ] ) ? $settings[ 'gaEventUA' ] : '';
465
  $ua_codes = $this->get_ua_codes( $feed_ua_code, $this->get_ga_id() );
466
  if ( empty( $ua_codes ) ) {
467
  GFCommon::add_error_message( __( 'You must set a UA code for event tracking to work.', 'gravity-forms-google-analytics-event-tracking' ) );
468
  return $feed_id;
469
+ }
470
+
471
+
472
  if ( $is_valid ) {
473
  $settings = $this->filter_settings( $sections, $settings );
474
  $feed_id = $this->save_feed_settings( $feed_id, $form_id, $settings );
483
 
484
  return $feed_id;
485
  }
486
+
487
  /**
488
  * Return Google Analytics GA Codes
489
+ *
490
  * @since 1.7.0
491
  * @return array Array of GA codes
492
  */
496
  $ga_ua = explode( ',', $feed_ua );
497
  if ( is_array( $ga_ua ) ) {
498
  foreach( $ga_ua as &$value ) {
499
+ $value = trim( $value );
500
+ }
501
  }
502
  $google_analytics_codes = $ga_ua;
503
  }
510
 
511
  /**
512
  * Form settings fields
513
+ *
514
  * @since 1.5.0
515
  * @return array Array of form settings
516
  */
592
 
593
  /**
594
  * Instruction field
595
+ *
596
  * @since 1.5.0
597
  */
598
  public function single_setting_row_instruction_field(){
624
  );
625
  }
626
 
627
+ }
includes/GFGAET_Tag_Manager.php CHANGED
File without changes
includes/GFGAET_UA.php CHANGED
File without changes
includes/vendor/ga-mp/src/Racecore/GATracking/Autoloader.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking;
3
-
4
- /**
5
- * Google Analytics Measurement PHP Class
6
- * Licensed under the 3-clause BSD License.
7
- * This source file is subject to the 3-clause BSD License that is
8
- * bundled with this package in the LICENSE file. It is also available at
9
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
10
- *
11
- * Google Documentation
12
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
13
- *
14
- * @author Marco Rieger
15
- * @email Rieger(at)racecore.de
16
- * @git https://github.com/ins0
17
- * @url http://www.racecore.de
18
- * @package Racecore\GATracking
19
- */
20
- class Autoloader
21
- {
22
- private $folder;
23
-
24
- /**
25
- * Constructor
26
- *
27
- * @param string $folder
28
- */
29
- public function __construct( $folder = null )
30
- {
31
- if ( ! $folder )
32
- {
33
- $folder = dirname(__FILE__) . '/..';
34
- }
35
-
36
- $this->folder = $folder;
37
- }
38
-
39
- /**
40
- * Handel autoloading of classes
41
- *
42
- * @param $class
43
- * @return bool|mixed
44
- */
45
- public function autoload( $class )
46
- {
47
- $filePath = $this->folder . '/' . str_replace('\\', '/', $class) . '.php';
48
-
49
- if (file_exists($filePath))
50
- {
51
- return ( (require_once $filePath) === false ? true : false );
52
- }
53
-
54
- return false;
55
- }
56
-
57
- /**
58
- * Register SPL Autoload
59
- *
60
- * @param null $folder
61
- * @return bool
62
- */
63
- public static function register( $folder = null )
64
- {
65
- ini_set('unserialize_callback_func', 'spl_autoload_call');
66
-
67
- return spl_autoload_register(
68
- array(
69
- new self($folder),
70
- 'autoload'
71
- )
72
- );
73
- }
74
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Exception.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking;
3
-
4
- /**
5
- * Google Analytics Measurement PHP Class
6
- * Licensed under the 3-clause BSD License.
7
- * This source file is subject to the 3-clause BSD License that is
8
- * bundled with this package in the LICENSE file. It is also available at
9
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
10
- *
11
- * Google Documentation
12
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
13
- *
14
- * @author Marco Rieger
15
- * @email Rieger(at)racecore.de
16
- * @git https://github.com/ins0
17
- * @url http://www.racecore.de
18
- * @package Racecore\GATracking
19
- */
20
- class Exception extends \UnexpectedValueException
21
- {
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Exception/EndpointServerException.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Exception;
3
-
4
- use Racecore\GATracking\Exception;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Exception
21
- */
22
- class EndpointServerException extends Exception
23
- {
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingConfigurationException.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Exception;
3
-
4
- use Racecore\GATracking\Exception;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Exception
21
- */
22
- class MissingConfigurationException extends Exception
23
- {
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingTrackingParameterException.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Exception;
3
-
4
- use Racecore\GATracking\Exception;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Exception
21
- */
22
- class MissingTrackingParameterException extends Exception
23
- {
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/GATracking.php DELETED
@@ -1,477 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking;
3
-
4
- use Racecore\GATracking\Exception\EndpointServerException;
5
- use Racecore\GATracking\Exception\MissingConfigurationException;
6
- use Racecore\GATracking\Tracking\AbstractTracking;
7
-
8
- /**
9
- * Google Analytics Measurement PHP Class
10
- * Licensed under the 3-clause BSD License.
11
- * This source file is subject to the 3-clause BSD License that is
12
- * bundled with this package in the LICENSE file. It is also available at
13
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
14
- *
15
- * Google Documentation
16
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
17
- *
18
- * @author Marco Rieger
19
- * @email Rieger(at)racecore.de
20
- * @git https://github.com/ins0
21
- * @url http://www.racecore.de
22
- * @package Racecore\GATracking\Tracking
23
- */
24
- class GATracking
25
- {
26
- /**
27
- * Google Analytics Account ID UA-...
28
- *
29
- * @var
30
- */
31
- private $accountID;
32
-
33
- /**
34
- * Current User Client ID
35
- *
36
- * @var string
37
- */
38
- private $clientID;
39
-
40
- /**
41
- * Current User ID
42
- *
43
- * @var string
44
- */
45
- private $userID = null;
46
-
47
- /**
48
- * Protocol Version
49
- *
50
- * @var string
51
- */
52
- private $protocol = '1';
53
-
54
- /**
55
- * Analytics Endpoint URL
56
- *
57
- * @var string
58
- */
59
- private $analytics_endpoint = 'http://www.google-analytics.com/collect';
60
-
61
- /**
62
- * Tacking Holder
63
- *
64
- * @var array
65
- */
66
- private $tracking_holder = array();
67
-
68
- /**
69
- * Holds the last Response from Google Analytics Server
70
- *
71
- * @var string
72
- */
73
- private $last_response = null;
74
-
75
- /**
76
- * Holds all Responses from GA Server
77
- *
78
- * @var array
79
- */
80
- private $last_response_stack = array();
81
-
82
- /**
83
- * Send Proxy Variables
84
- *
85
- * @var boolean
86
- */
87
- private $use_proxy;
88
-
89
- /**
90
- * Sets the Use Proxy variable
91
- *
92
- * @param $proxy
93
- */
94
- public function setProxy($proxy)
95
- {
96
- $this->use_proxy = $proxy;
97
- }
98
-
99
- /**
100
- * Returns the Use Proxy variable
101
- *
102
- * @return boolean
103
- */
104
- public function getProxy()
105
- {
106
- return $this->use_proxy;
107
- }
108
-
109
- /**
110
- * Sets the Analytics Account ID
111
- *
112
- * @param $account
113
- */
114
- public function setAccountID($account)
115
- {
116
-
117
- $this->accountID = $account;
118
- }
119
-
120
- /**
121
- * Set the current Client ID
122
- *
123
- * @param $clientID
124
- * @return $this
125
- */
126
- public function setClientID($clientID)
127
- {
128
- $this->clientID = $clientID;
129
- return $this;
130
- }
131
-
132
- /**
133
- * Returns the current Client ID
134
- *
135
- * @return string
136
- */
137
- public function getClientID()
138
- {
139
- if (!$this->clientID) {
140
- $this->clientID = $this->createClientID();
141
- }
142
-
143
- return $this->clientID;
144
- }
145
-
146
- /**
147
- * Set the current User ID
148
- *
149
- * @param $clientID
150
- * @return $this
151
- */
152
- public function setUserID($userID)
153
- {
154
- $this->userID = $userID;
155
- return $this;
156
- }
157
-
158
- /**
159
- * Returns the current User ID
160
- *
161
- * @return string
162
- */
163
- public function getUserID()
164
- {
165
- return $this->userID;
166
- }
167
-
168
- /**
169
- * Return all registered Events
170
- *
171
- * @return array
172
- */
173
- public function getEvents()
174
- {
175
- return $this->tracking_holder;
176
- }
177
-
178
- /**
179
- * Returns current Google Account ID
180
- *
181
- * @return mixed
182
- */
183
- public function getAccountID()
184
- {
185
- return $this->accountID;
186
- }
187
-
188
- /**
189
- * Constructor
190
- *
191
- * @param string $accountID
192
- * @param boolean $proxy (default: false)
193
- */
194
- public function __construct( $accountID = null, $proxy = false )
195
- {
196
- $this->setAccountID( $accountID );
197
- $this->setProxy($proxy);
198
-
199
- return $this;
200
- }
201
-
202
- /**
203
- * Create a GUID on Client specific values
204
- *
205
- * @return string
206
- */
207
- private function createClientID()
208
- {
209
- // collect user specific data
210
- if (isset($_COOKIE['_ga'])) {
211
-
212
- $gaCookie = explode('.', $_COOKIE['_ga']);
213
- if( isset($gaCookie[2] ) )
214
- {
215
- // check if uuid
216
- if( $this->checkUUID( $gaCookie[2] ) )
217
- {
218
- // uuid set in cookie
219
- return $gaCookie[2];
220
- }
221
- elseif( isset($gaCookie[2]) && isset($gaCookie[3]) )
222
- {
223
- // google default client id
224
- return $gaCookie[2] . '.' . $gaCookie[3];
225
- }
226
- }
227
- }
228
-
229
- // nothing found - return random uuid client id
230
- return $this->generateUUID();
231
- }
232
-
233
- /**
234
- * Check if is a valid UUID v4
235
- *
236
- * @param $uuid
237
- * @return int
238
- */
239
- private function checkUUID( $uuid )
240
- {
241
- return preg_match('#^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$#i', $uuid );
242
- }
243
-
244
- /**
245
- * Generate UUID v4 function - needed to generate a CID when one isn't available
246
- *
247
- * @author Andrew Moore http://www.php.net/manual/en/function.uniqid.php#94959
248
- * @return string
249
- */
250
- private function generateUUID() {
251
- return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
252
- // 32 bits for "time_low"
253
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
254
-
255
- // 16 bits for "time_mid"
256
- mt_rand( 0, 0xffff ),
257
-
258
- // 16 bits for "time_hi_and_version",
259
- // four most significant bits holds version number 4
260
- mt_rand( 0, 0x0fff ) | 0x4000,
261
-
262
- // 16 bits, 8 bits for "clk_seq_hi_res",
263
- // 8 bits for "clk_seq_low",
264
- // two most significant bits holds zero and one for variant DCE1.1
265
- mt_rand( 0, 0x3fff ) | 0x8000,
266
-
267
- // 48 bits for "node"
268
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
269
- );
270
- }
271
-
272
- /**
273
- * Send all captured Trackings to Analytics Server
274
- * Flush all prev. captured tracking responses
275
- *
276
- * @return bool
277
- */
278
- public function send()
279
- {
280
- // clear response logs
281
- $this->last_response_stack = array();
282
- $this->last_response = null;
283
-
284
- /** @var AbstractTracking $event */
285
- foreach ($this->tracking_holder as $tracking) {
286
- $this->sendTracking($tracking);
287
- }
288
-
289
- return true;
290
- }
291
-
292
- /**
293
- * Returns the Client IP
294
- * The last octect of the IP address is removed to anonymize the user
295
- *
296
- * @param string $address
297
- * @return string
298
- */
299
- function getClientIP($address = '')
300
- {
301
-
302
- if (!$address) {
303
- $address = $_SERVER['REMOTE_ADDR'];
304
- }
305
-
306
- if (!$address) {
307
- return '';
308
- }
309
-
310
- // Capture the first three octects of the IP address and replace the forth
311
- // with 0, e.g. 124.455.3.123 becomes 124.455.3.0
312
- $regex = "/^([^.]+\.[^.]+\.[^.]+\.).*/";
313
- if (preg_match($regex, $address, $matches)) {
314
- return $matches[1] . '0';
315
- }
316
-
317
- return '';
318
- }
319
-
320
- /**
321
- * Build the POST Packet
322
- *
323
- * @param AbstractTracking $event
324
- * @return string
325
- * @throws Exception\MissingConfigurationException
326
- */
327
- private function buildPacket( AbstractTracking $event )
328
- {
329
- // get packet
330
- $eventPacket = $event->getPaket();
331
-
332
- if( ! $this->getAccountID() )
333
- {
334
- throw new MissingConfigurationException('Google Account ID is missing');
335
- }
336
-
337
- // Add Protocol
338
- $eventPacket['v'] = $this->protocol; // protocol version
339
- $eventPacket['tid'] = $this->getAccountID(); // account id
340
- $eventPacket['cid'] = $this->getClientID(); // client id
341
-
342
- if($this->getUserID() != null){
343
- $eventPacket['uid'] = $this->getUserID();
344
- }
345
-
346
- //Proxy Variables
347
- if($this->getProxy()){
348
- $eventPacket['uip'] = $_SERVER['REMOTE_ADDR']; // IP Override
349
- $eventPacket['ua'] = $_SERVER['HTTP_USER_AGENT']; // UA Override
350
- }
351
-
352
- $eventPacket = array_reverse($eventPacket);
353
-
354
- // build query
355
- return http_build_query($eventPacket);
356
- }
357
-
358
- /**
359
- * Send an Event to Google Analytics
360
- * Will be removed
361
- *
362
- * @param AbstractTracking $tracking
363
- * @return bool
364
- * @throws Exception\EndpointServerException
365
- * @deprecated Use sendTracking
366
- */
367
- public function sendEvent(AbstractTracking $tracking)
368
- {
369
- return $this->sendTracking($tracking);
370
- }
371
-
372
- /**
373
- * Send an Event to Google Analytics
374
- *
375
- * @param AbstractTracking $event
376
- * @return bool
377
- * @throws Exception\EndpointServerException
378
- */
379
- public function sendTracking(AbstractTracking $event)
380
- {
381
- // get packet
382
- $eventPacket = $this->buildPacket( $event );
383
-
384
- // get endpoint
385
- $endpoint = parse_url($this->analytics_endpoint);
386
-
387
- // port
388
- $port = ($endpoint['scheme'] == 'https' ? 443 : 80);
389
-
390
- // connect
391
- $connection = @fsockopen($endpoint['scheme'] == 'https' ? 'ssl://' : $endpoint['host'], $port, $error, $errorstr, 10);
392
-
393
- if (!$connection) {
394
- throw new EndpointServerException('Analytics Host not reachable!');
395
- }
396
-
397
- $header = 'POST ' . $endpoint['path'] . ' HTTP/1.1' . "\r\n" .
398
- 'Host: ' . $endpoint['host'] . "\r\n" .
399
- 'User-Agent: Google-Measurement-PHP-Client' . "\r\n" .
400
- 'Content-Type: application/x-www-form-urlencoded' . "\r\n" .
401
- 'Content-Length: ' . strlen($eventPacket) . "\r\n" .
402
- 'Connection: Close' . "\r\n\r\n";
403
-
404
- $this->last_response = '';
405
-
406
- // frwite data
407
- fwrite($connection, $header);
408
- fwrite($connection, $eventPacket);
409
-
410
- // response
411
- $response = '';
412
-
413
- // receive response
414
- while (!feof($connection)) {
415
- $response .= fgets($connection, 1024);
416
- }
417
-
418
- // response
419
- $responseContainer = explode("\r\n\r\n", $response, 2);
420
- $responseContainer[0] = explode("\r\n", $responseContainer[0]);
421
-
422
- // save last response
423
- $this->addResponse( $responseContainer );
424
-
425
- // connection close
426
- fclose($connection);
427
-
428
- return true;
429
- }
430
-
431
- /**
432
- * Add a Response to the Stack
433
- *
434
- * @param $response
435
- * @return bool
436
- */
437
- public function addResponse( $response )
438
- {
439
- $this->last_response_stack[] = $response;
440
- $this->last_response = $response;
441
- return true;
442
- }
443
-
444
- /**
445
- * Returns the last Response from Google Analytics Server
446
- *
447
- * @author Marco Rieger
448
- * @return string
449
- */
450
- public function getLastResponse()
451
- {
452
- return $this->last_response;
453
- }
454
-
455
- /**
456
- * Returns all Responses since the last Send Method Call
457
- *
458
- * @return array
459
- */
460
- public function getLastResponseStack()
461
- {
462
- return $this->last_response_stack;
463
- }
464
-
465
- /**
466
- * Add Tracking Event
467
- *
468
- * @param AbstractTracking $tracking
469
- * @return $this
470
- */
471
- public function addTracking(AbstractTracking $tracking)
472
- {
473
- $this->tracking_holder[] = $tracking;
474
-
475
- return $this;
476
- }
477
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/AbstractTracking.php DELETED
@@ -1,685 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking;
3
-
4
- /**
5
- * Google Analytics Measurement PHP Class
6
- * Licensed under the 3-clause BSD License.
7
- * This source file is subject to the 3-clause BSD License that is
8
- * bundled with this package in the LICENSE file. It is also available at
9
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
10
- *
11
- * Google Documentation
12
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
13
- *
14
- * @author Marco Rieger
15
- * @email Rieger(at)racecore.de
16
- * @git https://github.com/ins0
17
- * @url http://www.racecore.de
18
- * @package Racecore\GATracking\Tracking
19
- */
20
- abstract class AbstractTracking
21
- {
22
- // document referrer
23
- /** @var String */
24
- private $documentReferrer;
25
-
26
- // campaign
27
- /** @var String */
28
- private $campaignName, $campaignSource, $campaignMedium, $campaignContent, $campaignID, $campaignKeyword;
29
-
30
- // adwords id
31
- /** @var String */
32
- private $adwordsID;
33
-
34
- // display ads id
35
- /** @var String */
36
- private $displayAdsID;
37
-
38
- // screen resolution
39
- /** @var String */
40
- private $screenResolution;
41
-
42
- // viewport size
43
- /** @var String */
44
- private $viewportSize;
45
-
46
- // document encoding
47
- /** @var String */
48
- private $documentEncoding;
49
-
50
- // screen colors
51
- /** @var String */
52
- private $screenColors;
53
-
54
- // user language
55
- /** @var String */
56
- private $userLanguage;
57
-
58
- // java enabled
59
- /** @var boolean|string */
60
- private $javaEnabled = null;
61
-
62
- // flash version
63
- /** @var String */
64
- private $flashVersion;
65
-
66
- // document location
67
- /** @var String */
68
- private $documentLocation;
69
-
70
- // document host
71
- /** @var String */
72
- private $documentHost;
73
-
74
- // document path
75
- /** @var String */
76
- private $documentPath;
77
-
78
- // document title
79
- /** @var String */
80
- private $documentTitle;
81
-
82
- // app name
83
- /** @var String */
84
- private $appName;
85
-
86
- // app version
87
- /** @var String */
88
- private $appVersion;
89
-
90
- // experiment id
91
- /** @var String */
92
- private $experimentID;
93
-
94
- // experiment variant
95
- /** @var String */
96
- private $experimentVariant;
97
-
98
- // content description
99
- /** @var String */
100
- private $contentDescription;
101
-
102
- // link id
103
- /** @var String */
104
- private $linkID;
105
-
106
- // custom dimensions
107
- /** @var Array */
108
- private $customDimension = array();
109
-
110
- // custom metric
111
- /** @var Array */
112
- private $customMetric = array();
113
-
114
- // productId
115
- /** @var string */
116
- private $productId;
117
-
118
- /**
119
- * Get the transfer Paket from current Event
120
- *
121
- * @return array
122
- */
123
- abstract public function createPackage();
124
-
125
- /**
126
- * Returns the Paket for Event Tracking
127
- *
128
- * @return array
129
- * @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
130
- * @deprecated
131
- */
132
- public function getPaket()
133
- {
134
- return $this->createPackage();
135
- }
136
-
137
- /**
138
- * @return array
139
- */
140
- public function getPackage()
141
- {
142
- $package = array_merge($this->createPackage(), array(
143
- // campaign
144
- 'cn' => $this->getCampaignName(),
145
- 'cs' => $this->getCampaignSource(),
146
- 'cm' => $this->getCampaignMedium(),
147
- 'ck' => $this->getCampaignKeyword(),
148
- 'cc' => $this->getCampaignContent(),
149
- 'ci' => $this->getCampaignID(),
150
-
151
- // other
152
- 'dr' => $this->getDocumentReferrer(),
153
- 'gclid' => $this->getAdwordsID(),
154
- 'dclid' => $this->getDisplayAdsID(),
155
-
156
- // system info
157
- 'sr' => $this->getScreenResolution(),
158
- 'sd' => $this->getScreenColors(),
159
- 'vp' => $this->getViewportSize(),
160
- 'de' => $this->getDocumentEncoding(),
161
- 'ul' => $this->getUserLanguage(),
162
- 'je' => $this->getJavaEnabled(),
163
- 'fl' => $this->getFlashVersion(),
164
-
165
- // Content Information
166
- 'dl' => $this->getDocumentLocation(),
167
- 'dh' => $this->getDocumentHost(),
168
- 'dp' => $this->getDocumentPath(),
169
- 'dt' => $this->getDocumentTitle(),
170
- 'cd' => $this->getContentDescription(),
171
- 'linkid' => $this->getLinkID(),
172
-
173
- // app tracking
174
- 'an' => $this->getAppName(),
175
- 'av' => $this->getAppVersion(),
176
-
177
- // enhanced e-commerce
178
-
179
-
180
-
181
- // content experiments
182
- 'xid' => $this->getExperimentID(),
183
- 'xvar' => $this->getExperimentVariant(),
184
- ));
185
-
186
- $package = $this->addCustomParameters($package);
187
-
188
- // remove all unused
189
- $package = array_filter($package, 'strlen');
190
-
191
- return $package;
192
- }
193
-
194
- /**
195
- * @param array $package
196
- * @return array
197
- */
198
- private function addCustomParameters( Array $package )
199
- {
200
- // add custom metric params
201
- foreach( $this->customMetric as $id => $value )
202
- {
203
- $package['cm' . (int) $id ] = $value;
204
- }
205
-
206
- // add custom dimension params
207
- foreach( $this->customDimension as $id => $value )
208
- {
209
- $package['cd' . (int) $id ] = $value;
210
- }
211
-
212
- return $package;
213
- }
214
-
215
- /**
216
- * @param null $id
217
- * @param $value
218
- */
219
- public function setCustomDimension($id = null, $value)
220
- {
221
- $this->customDimension[$id] = $value;
222
- }
223
-
224
- /**
225
- * @param null $id
226
- * @param $value
227
- */
228
- public function setCustomMetric($id = null, $value)
229
- {
230
- $this->customMetric[$id] = $value;
231
- }
232
-
233
- /**
234
- * @param String $contentDescription
235
- */
236
- public function setContentDescription($contentDescription)
237
- {
238
- $this->contentDescription = $contentDescription;
239
- }
240
-
241
- /**
242
- * @return String
243
- */
244
- public function getContentDescription()
245
- {
246
- return $this->contentDescription;
247
- }
248
-
249
- /**
250
- * @param String $linkID
251
- */
252
- public function setLinkID($linkID)
253
- {
254
- $this->linkID = $linkID;
255
- }
256
-
257
- /**
258
- * @return String
259
- */
260
- public function getLinkID()
261
- {
262
- return $this->linkID;
263
- }
264
-
265
- /**
266
- * @param String $adwordsID
267
- */
268
- public function setAdwordsID($adwordsID)
269
- {
270
- $this->adwordsID = $adwordsID;
271
- }
272
-
273
- /**
274
- * @return String
275
- */
276
- public function getAdwordsID()
277
- {
278
- return $this->adwordsID;
279
- }
280
-
281
- /**
282
- * @param String $appName
283
- */
284
- public function setAppName($appName)
285
- {
286
- $this->appName = $appName;
287
- }
288
-
289
- /**
290
- * @return String
291
- */
292
- public function getAppName()
293
- {
294
- return $this->appName;
295
- }
296
-
297
- /**
298
- * @param String $appVersion
299
- */
300
- public function setAppVersion($appVersion)
301
- {
302
- $this->appVersion = $appVersion;
303
- }
304
-
305
- /**
306
- * @return String
307
- */
308
- public function getAppVersion()
309
- {
310
- return $this->appVersion;
311
- }
312
-
313
- /**
314
- * @param String $campaignContent
315
- */
316
- public function setCampaignContent($campaignContent)
317
- {
318
- $this->campaignContent = $campaignContent;
319
- }
320
-
321
- /**
322
- * @return String
323
- */
324
- public function getCampaignContent()
325
- {
326
- return $this->campaignContent;
327
- }
328
-
329
- /**
330
- * @param String $campaignID
331
- */
332
- public function setCampaignID($campaignID)
333
- {
334
- $this->campaignID = $campaignID;
335
- }
336
-
337
- /**
338
- * @return String
339
- */
340
- public function getCampaignID()
341
- {
342
- return $this->campaignID;
343
- }
344
-
345
- /**
346
- * @param String $campaignKeyword
347
- */
348
- public function setCampaignKeyword($campaignKeyword)
349
- {
350
- $this->campaignKeyword = $campaignKeyword;
351
- }
352
-
353
- /**
354
- * @deprecated Use setCampaignKeyword
355
- * @param $campaignKeyword
356
- */
357
- public function setCampaignKeywords($campaignKeyword)
358
- {
359
- if( is_array($campaignKeyword) )
360
- {
361
- return $this->setCampaignKeyword(implode(',', $campaignKeyword));
362
- }
363
-
364
- $this->setCampaignKeyword($campaignKeyword);
365
- }
366
-
367
- /**
368
- * @return Array
369
- */
370
- public function getCampaignKeyword()
371
- {
372
- return $this->campaignKeyword;
373
- }
374
-
375
- /**
376
- * @param String $campaignMedium
377
- */
378
- public function setCampaignMedium($campaignMedium)
379
- {
380
- $this->campaignMedium = $campaignMedium;
381
- }
382
-
383
- /**
384
- * @return String
385
- */
386
- public function getCampaignMedium()
387
- {
388
- return $this->campaignMedium;
389
- }
390
-
391
- /**
392
- * @param String $campaignName
393
- */
394
- public function setCampaignName($campaignName)
395
- {
396
- $this->campaignName = $campaignName;
397
- }
398
-
399
- /**
400
- * @return String
401
- */
402
- public function getCampaignName()
403
- {
404
- return $this->campaignName;
405
- }
406
-
407
- /**
408
- * @param String $campaignSource
409
- */
410
- public function setCampaignSource($campaignSource)
411
- {
412
- $this->campaignSource = $campaignSource;
413
- }
414
-
415
- /**
416
- * @return String
417
- */
418
- public function getCampaignSource()
419
- {
420
- return $this->campaignSource;
421
- }
422
-
423
- /**
424
- * @param String $displayAdsID
425
- */
426
- public function setDisplayAdsID($displayAdsID)
427
- {
428
- $this->displayAdsID = $displayAdsID;
429
- }
430
-
431
- /**
432
- * @return String
433
- */
434
- public function getDisplayAdsID()
435
- {
436
- return $this->displayAdsID;
437
- }
438
-
439
- /**
440
- * @param String $documentEncoding
441
- */
442
- public function setDocumentEncoding($documentEncoding)
443
- {
444
- $this->documentEncoding = $documentEncoding;
445
- }
446
-
447
- /**
448
- * @return String
449
- */
450
- public function getDocumentEncoding()
451
- {
452
- return $this->documentEncoding;
453
- }
454
-
455
- /**
456
- * @param String $documentHost
457
- */
458
- public function setDocumentHost($documentHost)
459
- {
460
- $this->documentHost = $documentHost;
461
- }
462
-
463
- /**
464
- * @return String
465
- */
466
- public function getDocumentHost()
467
- {
468
- return $this->documentHost;
469
- }
470
-
471
- /**
472
- * @param String $documentLocation
473
- */
474
- public function setDocumentLocation($documentLocation)
475
- {
476
- $this->documentLocation = $documentLocation;
477
- }
478
-
479
- /**
480
- * @return String
481
- */
482
- public function getDocumentLocation()
483
- {
484
- return $this->documentLocation;
485
- }
486
-
487
- /**
488
- * @param String $documentPath
489
- */
490
- public function setDocumentPath($documentPath)
491
- {
492
- $this->documentPath = $documentPath;
493
- }
494
-
495
- /**
496
- * @return String
497
- */
498
- public function getDocumentPath()
499
- {
500
- return $this->documentPath;
501
- }
502
-
503
- /**
504
- * @param String $documentReferrer
505
- */
506
- public function setDocumentReferrer($documentReferrer)
507
- {
508
- $this->documentReferrer = $documentReferrer;
509
- }
510
-
511
- /**
512
- * @return String
513
- */
514
- public function getDocumentReferrer()
515
- {
516
- return $this->documentReferrer;
517
- }
518
-
519
- /**
520
- * @param String $documentTitle
521
- */
522
- public function setDocumentTitle($documentTitle)
523
- {
524
- $this->documentTitle = $documentTitle;
525
- }
526
-
527
- /**
528
- * @return String
529
- */
530
- public function getDocumentTitle()
531
- {
532
- return $this->documentTitle;
533
- }
534
-
535
- /**
536
- * @param String $experimentID
537
- */
538
- public function setExperimentID($experimentID)
539
- {
540
- $this->experimentID = $experimentID;
541
- }
542
-
543
- /**
544
- * @return String
545
- */
546
- public function getExperimentID()
547
- {
548
- return $this->experimentID;
549
- }
550
-
551
- /**
552
- * @param String $experimentVariant
553
- */
554
- public function setExperimentVariant($experimentVariant)
555
- {
556
- $this->experimentVariant = $experimentVariant;
557
- }
558
-
559
- /**
560
- * @return String
561
- */
562
- public function getExperimentVariant()
563
- {
564
- return $this->experimentVariant;
565
- }
566
-
567
- /**
568
- * @param String $flashVersion
569
- */
570
- public function setFlashVersion($flashVersion)
571
- {
572
- $this->flashVersion = $flashVersion;
573
- }
574
-
575
- /**
576
- * @return String
577
- */
578
- public function getFlashVersion()
579
- {
580
- return $this->flashVersion;
581
- }
582
-
583
- /**
584
- * @param boolean $javaEnabled
585
- */
586
- public function setJavaEnabled($javaEnabled)
587
- {
588
- $this->javaEnabled = (bool) $javaEnabled;
589
- }
590
-
591
- /**
592
- * @return boolean
593
- */
594
- public function getJavaEnabled()
595
- {
596
- if( $this->javaEnabled === null ){
597
- return null;
598
- }
599
-
600
- return $this->javaEnabled ? '1' : '0';
601
- }
602
-
603
- /**
604
- * @param String $screenColors
605
- */
606
- public function setScreenColors($screenColors)
607
- {
608
- $this->screenColors = $screenColors;
609
- }
610
-
611
- /**
612
- * @return String
613
- */
614
- public function getScreenColors()
615
- {
616
- return $this->screenColors;
617
- }
618
-
619
- /**
620
- * @param $width
621
- * @param $height
622
- */
623
- public function setScreenResolution($width, $height)
624
- {
625
- $this->screenResolution = $width . 'x' . $height;
626
- }
627
-
628
- /**
629
- * @return String
630
- */
631
- public function getScreenResolution()
632
- {
633
- return $this->screenResolution;
634
- }
635
-
636
- /**
637
- * @param String $userLanguage
638
- */
639
- public function setUserLanguage($userLanguage)
640
- {
641
- $this->userLanguage = $userLanguage;
642
- }
643
-
644
- /**
645
- * @return String
646
- */
647
- public function getUserLanguage()
648
- {
649
- return $this->userLanguage;
650
- }
651
-
652
- /**
653
- * @param $width
654
- * @param $height
655
- */
656
- public function setViewportSize($width, $height)
657
- {
658
- $this->viewportSize = $width . 'x' . $height;
659
- }
660
-
661
- /**
662
- * @return String
663
- */
664
- public function getViewportSize()
665
- {
666
- return $this->viewportSize;
667
- }
668
-
669
- /**
670
- * @param string $productId
671
- */
672
- public function setProductId($productId)
673
- {
674
- $this->productId = $productId;
675
- }
676
-
677
- /**
678
- * @return string
679
- */
680
- public function getProductId()
681
- {
682
- return $this->productId;
683
- }
684
-
685
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking\App;
3
-
4
- use Racecore\GATracking\Tracking\Event as DefaultEvent;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Tracking\App
21
- */
22
- class Event extends DefaultEvent
23
- {
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking\App;
3
-
4
- use Racecore\GATracking\Tracking\AbstractTracking;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Tracking\App
21
- */
22
- class Screen extends AbstractTracking
23
- {
24
- /**
25
- * Returns the Paket for App Screen Tracking
26
- *
27
- * @return array
28
- */
29
- public function createPackage()
30
- {
31
- return array(
32
- 't' => 'appview',
33
- );
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php DELETED
@@ -1,225 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking\Ecommerce;
3
-
4
- use Racecore\GATracking\Exception\MissingTrackingParameterException;
5
- use Racecore\GATracking\Tracking\AbstractTracking;
6
-
7
- /**
8
- * Google Analytics Measurement PHP Class
9
- * Licensed under the 3-clause BSD License.
10
- * This source file is subject to the 3-clause BSD License that is
11
- * bundled with this package in the LICENSE file. It is also available at
12
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
13
- *
14
- * Google Documentation
15
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
16
- *
17
- * @author Enea Berti
18
- * @email reysharks(at)gmail.com
19
- * @git https://github.com/reysharks
20
- * @url http://www.adacto.it
21
- * @package Racecore\GATracking\Tracking
22
- */
23
- class Item extends AbstractTracking
24
- {
25
-
26
- private $tid = 0;
27
- private $name = '';
28
- private $price = 0;
29
- private $quantity = 0;
30
- private $sku = '';
31
- private $category = '';
32
- private $currency = '';
33
-
34
- /**
35
- * @param $host
36
- * @deprecated
37
- */
38
- public function setTransactionHost( $host )
39
- {
40
- return $this->setDocumentHost( $host );
41
- }
42
-
43
- /**
44
- * Set the Transaction ID
45
- *
46
- * @param $tid
47
- */
48
- public function setTransactionID($tid)
49
- {
50
-
51
- $this->tid = $tid;
52
- }
53
-
54
- /**
55
- * Returns the Transaction ID
56
- *
57
- * @return integer
58
- */
59
- public function getTransactionID()
60
- {
61
-
62
- if (!$this->tid) {
63
- return '/';
64
- }
65
-
66
- return $this->tid;
67
- }
68
-
69
- /**
70
- * Sets the Item Name
71
- *
72
- * @param $name
73
- */
74
- public function setName($name)
75
- {
76
-
77
- $this->name = $name;
78
- }
79
-
80
- /**
81
- * Return Name
82
- *
83
- * @return string
84
- */
85
- public function getName()
86
- {
87
-
88
- if (!$this->name) {
89
- return $this->sku;
90
- }
91
-
92
- return $this->name;
93
- }
94
-
95
- /**
96
- * Sets the Item Price
97
- *
98
- * @param $price
99
- */
100
- public function setPrice($price)
101
- {
102
- $this->price = $price;
103
- }
104
-
105
- /**
106
- * Return the Price
107
- *
108
- * @return float
109
- */
110
- public function getPrice()
111
- {
112
- return $this->price;
113
- }
114
-
115
- /**
116
- * Sets the Quantity
117
- *
118
- * @param $quantity
119
- */
120
- public function setQuantity($quantity)
121
- {
122
- $this->quantity = $quantity;
123
- }
124
-
125
- /**
126
- * Return Quantity
127
- *
128
- * @return integer
129
- */
130
- public function getQuantity()
131
- {
132
- return $this->quantity;
133
- }
134
-
135
- /**
136
- * Sets the Sku
137
- *
138
- * @param $sku
139
- */
140
- public function setSku($sku)
141
- {
142
- $this->sku = $sku;
143
- }
144
-
145
- /**
146
- * Return the Sku
147
- *
148
- * @return float
149
- */
150
- public function getSku()
151
- {
152
- return $this->sku;
153
- }
154
-
155
- /**
156
- * Sets the Category
157
- *
158
- * @param $category
159
- */
160
- public function setCategory($category)
161
- {
162
- $this->category = $category;
163
- }
164
-
165
- /**
166
- * Return the Category
167
- *
168
- * @return float
169
- */
170
- public function getCategory()
171
- {
172
- return $this->category;
173
- }
174
-
175
- /**
176
- * Sets the Currency
177
- *
178
- * @param $currency
179
- */
180
- public function setCurrency($currency)
181
- {
182
- $this->currency = $currency;
183
- }
184
-
185
- /**
186
- * Return the Currency
187
- *
188
- * @return string
189
- */
190
- public function getCurrency()
191
- {
192
- return $this->currency;
193
- }
194
-
195
- /**
196
- * Create the Package
197
- *
198
- * @return array
199
- * @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
200
- */
201
- public function createPackage()
202
- {
203
- if( !$this->getTransactionID() )
204
- {
205
- throw new MissingTrackingParameterException('transaction id is missing');
206
- }
207
-
208
- if( !$this->getName() )
209
- {
210
- throw new MissingTrackingParameterException('item name is missing');
211
- }
212
-
213
- return array(
214
- 't' => 'item',
215
- 'ti' => $this->getTransactionID(),
216
- 'in' => $this->getName(),
217
- 'ip' => $this->getPrice(),
218
- 'iq' => $this->getQuantity(),
219
- 'ic' => $this->getSku(),
220
- 'iv' => $this->getCategory(),
221
- 'cu' => $this->getCurrency()
222
- );
223
- }
224
-
225
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php DELETED
@@ -1,194 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking\Ecommerce;
3
-
4
- use Racecore\GATracking\Exception\MissingTrackingParameterException;
5
- use Racecore\GATracking\Tracking\AbstractTracking;
6
-
7
- /**
8
- * Google Analytics Measurement PHP Class
9
- * Licensed under the 3-clause BSD License.
10
- * This source file is subject to the 3-clause BSD License that is
11
- * bundled with this package in the LICENSE file. It is also available at
12
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
13
- *
14
- * Google Documentation
15
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
16
- *
17
- * @author Enea Berti
18
- * @email reysharks(at)gmail.com
19
- * @git https://github.com/reysharks
20
- * @url http://www.adacto.it
21
- * @package Racecore\GATracking\Tracking
22
- */
23
- class Transaction extends AbstractTracking
24
- {
25
-
26
- private $id = 0;
27
- private $affiliation = '';
28
- private $revenue = 0;
29
- private $shipping = 0;
30
- private $tax = 0;
31
- private $currency = '';
32
-
33
- /**
34
- * @param $host
35
- * @deprecated
36
- */
37
- public function setTransactionHost( $host )
38
- {
39
- return $this->setDocumentHost( $host );
40
- }
41
-
42
- /**
43
- * Set the Transaction ID
44
- *
45
- * @param $id
46
- */
47
- public function setID($id)
48
- {
49
-
50
- $this->id = $id;
51
- }
52
-
53
- /**
54
- * Returns the Transaction ID
55
- *
56
- * @return integer
57
- */
58
- public function getID()
59
- {
60
-
61
- if (!$this->id) {
62
- return '/';
63
- }
64
-
65
- return $this->id;
66
- }
67
-
68
- /**
69
- * Sets the Affiliation
70
- *
71
- * @param $affiliation
72
- */
73
- public function setAffiliation($affiliation)
74
- {
75
-
76
- $this->affiliation = $affiliation;
77
- }
78
-
79
- /**
80
- * Return Affiliation
81
- *
82
- * @return string
83
- */
84
- public function getAffiliation()
85
- {
86
-
87
- return $this->affiliation;
88
- }
89
-
90
- /**
91
- * Sets the Revenue
92
- *
93
- * @param $revenue
94
- */
95
- public function setRevenue($revenue)
96
- {
97
- $this->revenue = $revenue;
98
- }
99
-
100
- /**
101
- * Return the Revenue
102
- *
103
- * @return float
104
- */
105
- public function getRevenue()
106
- {
107
- return $this->revenue;
108
- }
109
-
110
- /**
111
- * Sets the Shipping
112
- *
113
- * @param $shipping
114
- */
115
- public function setShipping($shipping)
116
- {
117
- $this->shipping = $shipping;
118
- }
119
-
120
- /**
121
- * Return Shipping
122
- *
123
- * @return float
124
- */
125
- public function getShipping()
126
- {
127
- return $this->shipping;
128
- }
129
-
130
- /**
131
- * Sets the Tax
132
- *
133
- * @param $tax
134
- */
135
- public function setTax($tax)
136
- {
137
- $this->tax = $tax;
138
- }
139
-
140
- /**
141
- * Return the Tax
142
- *
143
- * @return float
144
- */
145
- public function getTax()
146
- {
147
- return $this->tax;
148
- }
149
-
150
- /**
151
- * Sets the Currency
152
- *
153
- * @param $currency
154
- */
155
- public function setCurrency($currency)
156
- {
157
- $this->currency = $currency;
158
- }
159
-
160
- /**
161
- * Return the Currency
162
- *
163
- * @return string
164
- */
165
- public function getCurrency()
166
- {
167
- return $this->currency;
168
- }
169
-
170
- /**
171
- * Returns the Google Paket for Transaction Tracking
172
- *
173
- * @return array
174
- * @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
175
- */
176
- public function createPackage()
177
- {
178
- if( !$this->getID() )
179
- {
180
- throw new MissingTrackingParameterException('transaction id is missing');
181
- }
182
-
183
- return array(
184
- 't' => 'transaction',
185
- 'ti' => $this->getID(),
186
- 'ta' => $this->getAffiliation(),
187
- 'tr' => $this->getRevenue(),
188
- 'ts' => $this->getShipping(),
189
- 'tt' => $this->getTax(),
190
- 'cu' => $this->getCurrency()
191
- );
192
- }
193
-
194
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking;
3
-
4
- use Racecore\GATracking\Exception\MissingTrackingParameterException;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Tracking
21
- */
22
- class Event extends AbstractTracking
23
- {
24
- /** @var String */
25
- private $eventCategory;
26
-
27
- /** @var String */
28
- private $eventAction;
29
-
30
- /** @var String */
31
- private $eventLabel;
32
-
33
- /** @var String */
34
- private $eventValue;
35
-
36
- /**
37
- * Set the Event Action (Required)
38
- *
39
- * @param $eventAction
40
- * @return $this
41
- */
42
- public function setEventAction($eventAction)
43
- {
44
- $this->eventAction = $eventAction;
45
- return $this;
46
- }
47
-
48
- /**
49
- * Get the Event Action
50
- *
51
- * @return $this
52
- */
53
- public function getEventAction()
54
- {
55
- return $this->eventAction;
56
- }
57
-
58
- /**
59
- * Set the Event Category (Required)
60
- *
61
- * @param $eventCategory
62
- * @return $this
63
- */
64
- public function setEventCategory($eventCategory)
65
- {
66
- $this->eventCategory = $eventCategory;
67
- return $this;
68
- }
69
-
70
- /**
71
- * Get the Event Category
72
- *
73
- * @return $this
74
- */
75
- public function getEventCategory()
76
- {
77
- return $this->eventCategory;
78
- }
79
-
80
- /**
81
- * Set the Event Label
82
- *
83
- * @param $eventLabel
84
- * @return $this
85
- */
86
- public function setEventLabel($eventLabel)
87
- {
88
- $this->eventLabel = $eventLabel;
89
- return $this;
90
- }
91
-
92
- /**
93
- * Get the Event Label
94
- *
95
- * @return $this
96
- */
97
- public function getEventLabel()
98
- {
99
- return $this->eventLabel;
100
- }
101
-
102
- /**
103
- * Set the Event Value
104
- *
105
- * @param $eventValue
106
- * @return $this
107
- */
108
- public function setEventValue($eventValue)
109
- {
110
- $this->eventValue = $eventValue;
111
- return $this;
112
- }
113
-
114
- /**
115
- * Get the Event Value
116
- *
117
- * @return $this
118
- */
119
- public function getEventValue()
120
- {
121
- return $this->eventValue;
122
- }
123
-
124
- /**
125
- * Returns the Paket for Event Tracking
126
- *
127
- * @return array
128
- * @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
129
- */
130
- public function createPackage()
131
- {
132
- if (!$this->getEventCategory()) {
133
- throw new MissingTrackingParameterException('event category musst be set');
134
- }
135
-
136
- if (!$this->getEventAction()) {
137
- throw new MissingTrackingParameterException('event action musst be set');
138
- }
139
-
140
- return array(
141
- 't' => 'event',
142
- 'ec' => $this->getEventCategory(),
143
- 'ea' => $this->getEventAction(),
144
- 'el' => $this->getEventLabel(),
145
- 'ev' => $this->getEventValue()
146
- );
147
- }
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking;
3
-
4
- /**
5
- * Google Analytics Measurement PHP Class
6
- * Licensed under the 3-clause BSD License.
7
- * This source file is subject to the 3-clause BSD License that is
8
- * bundled with this package in the LICENSE file. It is also available at
9
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
10
- *
11
- * Google Documentation
12
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
13
- *
14
- * @author Marco Rieger
15
- * @email Rieger(at)racecore.de
16
- * @git https://github.com/ins0
17
- * @url http://www.racecore.de
18
- * @package Racecore\GATracking\Tracking
19
- */
20
- class Exception extends AbstractTracking
21
- {
22
- /** @var string */
23
- private $exceptionDescription;
24
-
25
- /** @var bool */
26
- private $exceptionFatal;
27
-
28
- /**
29
- * Set the Exception Description
30
- *
31
- * @param $exceptionDescription
32
- * @return $this
33
- */
34
- public function setExceptionDescription($exceptionDescription)
35
- {
36
- $this->exceptionDescription = $exceptionDescription;
37
- return $this;
38
- }
39
-
40
- /**
41
- * Get the Exception Description
42
- *
43
- * @return String
44
- */
45
- public function getExceptionDescription()
46
- {
47
- return $this->exceptionDescription;
48
- }
49
-
50
- /**
51
- * Set if Exception is fatal
52
- *
53
- * @param $exceptionFatal
54
- * @return $this
55
- */
56
- public function setExceptionFatal($exceptionFatal)
57
- {
58
- $this->exceptionFatal = (bool) $exceptionFatal;
59
- return $this;
60
- }
61
-
62
- /**
63
- * Get Exception is fatal
64
- *
65
- * @return bool
66
- */
67
- public function getExceptionFatal()
68
- {
69
- return $this->exceptionFatal;
70
- }
71
-
72
- /**
73
- * Returns the Paket for Exception Tracking
74
- *
75
- * @return array
76
- */
77
- public function createPackage()
78
- {
79
- return array(
80
- 't' => 'exception',
81
- 'exd' => $this->getExceptionDescription(),
82
- 'exf' => ( $this->getExceptionFatal() ? '1' : '0' )
83
- );
84
- }
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking;
3
-
4
- /**
5
- * Google Analytics Measurement PHP Class
6
- * Licensed under the 3-clause BSD License.
7
- * This source file is subject to the 3-clause BSD License that is
8
- * bundled with this package in the LICENSE file. It is also available at
9
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
10
- *
11
- * Google Documentation
12
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
13
- *
14
- * @author Marco Rieger
15
- * @email Rieger(at)racecore.de
16
- * @git https://github.com/ins0
17
- * @url http://www.racecore.de
18
- * @package Racecore\GATracking\Tracking
19
- */
20
- class Page extends AbstractTracking
21
- {
22
- /**
23
- * Returns the Google Paket for Campaign Tracking
24
- *
25
- * @return array
26
- */
27
- public function createPackage()
28
- {
29
- return array(
30
- 't' => 'pageview',
31
- );
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking;
3
- use Racecore\GATracking\Exception\MissingTrackingParameterException;
4
-
5
- /**
6
- * Google Analytics Measurement PHP Class
7
- * Licensed under the 3-clause BSD License.
8
- * This source file is subject to the 3-clause BSD License that is
9
- * bundled with this package in the LICENSE file. It is also available at
10
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
11
- *
12
- * Google Documentation
13
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
14
- *
15
- * @author Marco Rieger
16
- * @email Rieger(at)racecore.de
17
- * @git https://github.com/ins0
18
- * @url http://www.racecore.de
19
- * @package Racecore\GATracking\Tracking
20
- */
21
- class Social extends AbstractTracking
22
- {
23
- /** @var String */
24
- private $socialAction;
25
-
26
- /** @var String */
27
- private $socialNetwork;
28
-
29
- /** @var String */
30
- private $socialTarget;
31
-
32
- /**
33
- * Set the Social Action (Required)
34
- *
35
- * @param $socialAction
36
- * @return $this
37
- */
38
- public function setSocialAction($socialAction)
39
- {
40
- $this->socialAction = $socialAction;
41
- return $this;
42
- }
43
-
44
- /**
45
- * Get the Social Action
46
- *
47
- * @return String
48
- */
49
- public function getSocialAction()
50
- {
51
- return $this->socialAction;
52
- }
53
-
54
- /**
55
- * Set the Social Network (Required)
56
- *
57
- * @param $socialNetwork
58
- * @return $this
59
- */
60
- public function setSocialNetwork($socialNetwork)
61
- {
62
- $this->socialNetwork = $socialNetwork;
63
- return $this;
64
- }
65
-
66
- /**
67
- * Get the Social Network
68
- *
69
- * @return String
70
- */
71
- public function getSocialNetwork()
72
- {
73
- return $this->socialNetwork;
74
- }
75
-
76
- /**
77
- * Set the Social Target (Required)
78
- *
79
- * @param $socialTarget
80
- * @return $this
81
- */
82
- public function setSocialTarget($socialTarget)
83
- {
84
- $this->socialTarget = $socialTarget;
85
- return $this;
86
- }
87
-
88
- /**
89
- * Get the Social Target
90
- *
91
- * @return String
92
- */
93
- public function getSocialTarget()
94
- {
95
- return $this->socialTarget;
96
- }
97
-
98
- /**
99
- * Returns the Google Paket for Social Tracking
100
- *
101
- * @return array
102
- * @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
103
- */
104
- public function createPackage()
105
- {
106
- if (!$this->getSocialAction()) {
107
- throw new MissingTrackingParameterException('social action musst be set');
108
- }
109
-
110
- if (!$this->getSocialNetwork()) {
111
- throw new MissingTrackingParameterException('social network musst be set');
112
- }
113
-
114
- if (!$this->getSocialTarget()) {
115
- throw new MissingTrackingParameterException('social target musst be set');
116
- }
117
-
118
- return array(
119
- 't' => 'social',
120
- 'sa' => $this->getSocialAction(),
121
- 'sn' => $this->getSocialNetwork(),
122
- 'st' => $this->getSocialTarget()
123
- );
124
- }
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php DELETED
@@ -1,250 +0,0 @@
1
- <?php
2
- namespace Racecore\GATracking\Tracking\User;
3
-
4
- use Racecore\GATracking\Tracking\AbstractTracking;
5
-
6
- /**
7
- * Google Analytics Measurement PHP Class
8
- * Licensed under the 3-clause BSD License.
9
- * This source file is subject to the 3-clause BSD License that is
10
- * bundled with this package in the LICENSE file. It is also available at
11
- * the following URL: http://www.opensource.org/licenses/BSD-3-Clause
12
- *
13
- * Google Documentation
14
- * https://developers.google.com/analytics/devguides/collection/protocol/v1/
15
- *
16
- * @author Marco Rieger
17
- * @email Rieger(at)racecore.de
18
- * @git https://github.com/ins0
19
- * @url http://www.racecore.de
20
- * @package Racecore\GATracking\Tracking\User
21
- */
22
- class Timing extends AbstractTracking
23
- {
24
- /** @var string */
25
- private $timingCategory;
26
-
27
- /** @var string */
28
- private $timingVariable;
29
-
30
- /** @var integer */
31
- private $timingTime;
32
-
33
- /** @var string */
34
- private $timingLabel;
35
-
36
- /** @var integer */
37
- private $browserDnsLoadTime;
38
-
39
- /** @var integer */
40
- private $browserPageDownloadTime;
41
-
42
- /** @var integer */
43
- private $browserRedirectTime;
44
-
45
- /** @var integer */
46
- private $browserTcpConnectTime;
47
-
48
- /** @var integer */
49
- private $browserServerResponseTime;
50
-
51
- /**
52
- * Set the browser dns load time
53
- *
54
- * @param int $browserDnsLoadTime
55
- */
56
- public function setBrowserDnsLoadTime($browserDnsLoadTime)
57
- {
58
- $this->browserDnsLoadTime = $browserDnsLoadTime;
59
- }
60
-
61
- /**
62
- * Get the browser dns load time
63
- *
64
- * @return int
65
- */
66
- public function getBrowserDnsLoadTime()
67
- {
68
- return $this->browserDnsLoadTime;
69
- }
70
-
71
- /**
72
- * Set the browser page download time
73
- *
74
- * @param int $browserPageDownloadTime
75
- */
76
- public function setBrowserPageDownloadTime($browserPageDownloadTime)
77
- {
78
- $this->browserPageDownloadTime = $browserPageDownloadTime;
79
- }
80
-
81
- /**
82
- * Get the browser page download time
83
- * @return int
84
- */
85
- public function getBrowserPageDownloadTime()
86
- {
87
- return $this->browserPageDownloadTime;
88
- }
89
-
90
- /**
91
- * Set the browser redirect time
92
- *
93
- * @param int $browserRedirectTime
94
- */
95
- public function setBrowserRedirectTime($browserRedirectTime)
96
- {
97
- $this->browserRedirectTime = $browserRedirectTime;
98
- }
99
-
100
- /**
101
- * Get the browser redirect time
102
- *
103
- * @return int
104
- */
105
- public function getBrowserRedirectTime()
106
- {
107
- return $this->browserRedirectTime;
108
- }
109
-
110
- /**
111
- * Set the browser server response time
112
- *
113
- * @param int $browserServerResponseTime
114
- */
115
- public function setBrowserServerResponseTime($browserServerResponseTime)
116
- {
117
- $this->browserServerResponseTime = $browserServerResponseTime;
118
- }
119
-
120
- /**
121
- * Get the browser server response time
122
- *
123
- * @return int
124
- */
125
- public function getBrowserServerResponseTime()
126
- {
127
- return $this->browserServerResponseTime;
128
- }
129
-
130
- /**
131
- * Set the browser tcp conenct time
132
- *
133
- * @param int $browserTcpConnectTime
134
- */
135
- public function setBrowserTcpConnectTime($browserTcpConnectTime)
136
- {
137
- $this->browserTcpConnectTime = $browserTcpConnectTime;
138
- }
139
-
140
- /**
141
- * Get the browser tcp conenct time
142
- *
143
- * @return int
144
- */
145
- public function getBrowserTcpConnectTime()
146
- {
147
- return $this->browserTcpConnectTime;
148
- }
149
-
150
- /**
151
- * Set the timing category
152
- *
153
- * @param string $timingCategory
154
- */
155
- public function setTimingCategory($timingCategory)
156
- {
157
- $this->timingCategory = $timingCategory;
158
- }
159
-
160
- /**
161
- * Get the timing category
162
- *
163
- * @return string
164
- */
165
- public function getTimingCategory()
166
- {
167
- return $this->timingCategory;
168
- }
169
-
170
- /**
171
- * Set the timing label
172
- *
173
- * @param string $timingLabel
174
- */
175
- public function setTimingLabel($timingLabel)
176
- {
177
- $this->timingLabel = $timingLabel;
178
- }
179
-
180
- /**
181
- * Get the timing label
182
- *
183
- * @return string
184
- */
185
- public function getTimingLabel()
186
- {
187
- return $this->timingLabel;
188
- }
189
-
190
- /**
191
- * Set the timing time
192
- *
193
- * @param int $timingTime
194
- */
195
- public function setTimingTime($timingTime)
196
- {
197
- $this->timingTime = $timingTime;
198
- }
199
-
200
- /**
201
- * Get the timing time
202
- *
203
- * @return int
204
- */
205
- public function getTimingTime()
206
- {
207
- return $this->timingTime;
208
- }
209
-
210
- /**
211
- * Set the timing variable
212
- *
213
- * @param string $timingVariable
214
- */
215
- public function setTimingVariable($timingVariable)
216
- {
217
- $this->timingVariable = $timingVariable;
218
- }
219
-
220
- /**
221
- * Get the timing time
222
- *
223
- * @return string
224
- */
225
- public function getTimingVariable()
226
- {
227
- return $this->timingVariable;
228
- }
229
-
230
- /**
231
- * Returns the Paket for User Timing Tracking
232
- *
233
- * @return array
234
- */
235
- public function createPackage()
236
- {
237
- return array(
238
- 't' => 'timing',
239
- 'utc' => $this->getTimingCategory(),
240
- 'utv' => $this->getTimingVariable(),
241
- 'utt' => $this->getTimingTime(),
242
- 'utl' => $this->getTimingLabel(),
243
- 'dns' => $this->getBrowserDnsLoadTime(),
244
- 'pdt' => $this->getBrowserPageDownloadTime(),
245
- 'rrt' => $this->getBrowserRedirectTime(),
246
- 'tcp' => $this->getBrowserTcpConnectTime(),
247
- 'srt' => $this->getBrowserServerResponseTime()
248
- );
249
- }
250
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.php CHANGED
File without changes
languages/gravity-forms-google-analytics-event-tracking.pot CHANGED
File without changes
languages/index.php CHANGED
File without changes