Version Description
- Moved the form specific settings to their own tab.
- Re-structured the plugin code to fall in line with the official Gravity Forms plugins.
- Added a disable option to prevent a form from tracking any events.
- Added merge tag (choose a form field dropdown) to the settings fields for more dynamic tracking capabilities.
Download this release
Release Info
| Developer | nmarks |
| Plugin | |
| Version | 1.5.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.5 to 1.5.0
- README.txt +11 -5
- gravity-forms-event-tracking.php +11 -18
- includes/class-gravity-forms-event-tracking.php +478 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Autoloader.php +74 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception.php +22 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception/EndpointServerException.php +24 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingConfigurationException.php +24 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingTrackingParameterException.php +24 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/GATracking.php +477 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/AbstractTracking.php +31 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php +107 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php +107 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Campaign.php +233 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php +230 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php +209 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php +148 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php +85 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php +112 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php +125 -0
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php +250 -0
README.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
=== Gravity Forms Google Analytics Event Tracking ===
|
| 2 |
-
Contributors: nmarks
|
| 3 |
Tags: gravity forms, google analytics, event tracking
|
| 4 |
Requires at least: 3.5.2
|
| 5 |
Tested up to: 4.1
|
| 6 |
-
Stable tag: 1.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -19,11 +19,11 @@ Looking for help setting things up? [Read My Setup Guide](http://nvis.io/x8fld)
|
|
| 19 |
= Features =
|
| 20 |
- Automatically send form submission events to Google Analytics
|
| 21 |
- Custom event categories, actions, labels and even values
|
| 22 |
-
- Dynamic event value on payment forms (integration with the payment add-ons including Paypal Standard)
|
| 23 |
- Awesomeness
|
| 24 |
|
| 25 |
= Configuration =
|
| 26 |
-
After installing, you setup your UA ID in the Event Tracking tab on Gravity Forms' settings page and then customize your event category/action/label/value on the form settings page (see screenshots for more information).
|
| 27 |
|
| 28 |
For payment based forms, you can leave the value blank to convert using the total payment amount.
|
| 29 |
|
|
@@ -34,7 +34,7 @@ Check out the documentation on [github](https://github.com/nathanmarks/wordpress
|
|
| 34 |
|
| 35 |
= Minimum Requirements =
|
| 36 |
- PHP 5.3+
|
| 37 |
-
- Gravity Forms 1.
|
| 38 |
|
| 39 |
= Using The WordPress Dashboard =
|
| 40 |
|
|
@@ -76,6 +76,12 @@ Check out the documentation on [github](https://github.com/nathanmarks/wordpress
|
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
= 1.4.5 =
|
| 80 |
* Fixed a bug where the source/medium was not being tracked correctly for PayPal Standard IPN Notification based conversions.
|
| 81 |
|
| 1 |
=== Gravity Forms Google Analytics Event Tracking ===
|
| 2 |
+
Contributors: nmarks
|
| 3 |
Tags: gravity forms, google analytics, event tracking
|
| 4 |
Requires at least: 3.5.2
|
| 5 |
Tested up to: 4.1
|
| 6 |
+
Stable tag: 1.5.0
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 19 |
= Features =
|
| 20 |
- Automatically send form submission events to Google Analytics
|
| 21 |
- Custom event categories, actions, labels and even values
|
| 22 |
+
- Dynamic event value on payment forms (integration with the payment add-ons including Paypal Standard, PayPal Pro, Stripe, etc...)
|
| 23 |
- Awesomeness
|
| 24 |
|
| 25 |
= Configuration =
|
| 26 |
+
After installing, you setup your UA ID in the Event Tracking tab on Gravity Forms' settings page and then customize your event category/action/label/value on the form event tracking settings page (see screenshots for more information).
|
| 27 |
|
| 28 |
For payment based forms, you can leave the value blank to convert using the total payment amount.
|
| 29 |
|
| 34 |
|
| 35 |
= Minimum Requirements =
|
| 36 |
- PHP 5.3+
|
| 37 |
+
- Gravity Forms 1.8+
|
| 38 |
|
| 39 |
= Using The WordPress Dashboard =
|
| 40 |
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
| 79 |
+
= 1.5.0 =
|
| 80 |
+
* Moved the form specific settings to their own tab.
|
| 81 |
+
* Re-structured the plugin code to fall in line with the official Gravity Forms plugins.
|
| 82 |
+
* Added a disable option to prevent a form from tracking any events.
|
| 83 |
+
* Added merge tag (choose a form field dropdown) to the settings fields for more dynamic tracking capabilities.
|
| 84 |
+
|
| 85 |
= 1.4.5 =
|
| 86 |
* Fixed a bug where the source/medium was not being tracked correctly for PayPal Standard IPN Notification based conversions.
|
| 87 |
|
gravity-forms-event-tracking.php
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
* Plugin Name: Gravity Forms Google Analytics Event Tracking
|
| 11 |
* Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
|
| 12 |
* Description: Add Google Analytics event tracking to your Gravity Forms with ease.
|
| 13 |
-
* Version: 1.
|
| 14 |
* Author: Nathan Marks
|
| 15 |
* Author URI: http://www.nvisionsolutions.ca
|
| 16 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
|
@@ -25,27 +25,20 @@ if ( ! defined( 'WPINC' ) ) {
|
|
| 25 |
die;
|
| 26 |
}
|
| 27 |
|
| 28 |
-
|
| 29 |
-
* Public-Facing Functionality
|
| 30 |
-
*----------------------------------------------------------------------------*/
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
* Dashboard and Administrative Functionality
|
| 39 |
-
*----------------------------------------------------------------------------*/
|
| 40 |
|
| 41 |
-
|
| 42 |
-
*
|
| 43 |
-
* The code below is intended to to give the lightest footprint possible.
|
| 44 |
-
*/
|
| 45 |
-
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
| 46 |
-
|
| 47 |
-
require_once( plugin_dir_path( __FILE__ ) . 'admin/class-gravity-forms-event-tracking-admin.php' );
|
| 48 |
-
require_once( plugin_dir_path( __FILE__ ) . 'admin/class-gravity-forms-event-tracking-addon.php' );
|
| 49 |
-
add_action( 'plugins_loaded', array( 'Gravity_Forms_Event_Tracking_Admin', 'get_instance' ) );
|
| 50 |
|
| 51 |
}
|
|
|
|
|
|
| 10 |
* Plugin Name: Gravity Forms Google Analytics Event Tracking
|
| 11 |
* Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
|
| 12 |
* Description: Add Google Analytics event tracking to your Gravity Forms with ease.
|
| 13 |
+
* Version: 1.5.0
|
| 14 |
* Author: Nathan Marks
|
| 15 |
* Author URI: http://www.nvisionsolutions.ca
|
| 16 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
| 25 |
die;
|
| 26 |
}
|
| 27 |
|
| 28 |
+
class Gravity_Forms_Event_Tracking_Bootstrap {
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
public static function load(){
|
| 31 |
|
| 32 |
+
if ( ! method_exists( 'GFForms', 'include_addon_framework' ) ) {
|
| 33 |
+
return;
|
| 34 |
+
}
|
| 35 |
|
| 36 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-gravity-forms-event-tracking.php' );
|
| 37 |
|
| 38 |
+
GFAddOn::register( 'Gravity_Forms_Event_Tracking' );
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
}
|
| 43 |
+
|
| 44 |
+
add_action( 'gform_loaded', array( 'Gravity_Forms_Event_Tracking_Bootstrap', 'load' ), 5 );
|
includes/class-gravity-forms-event-tracking.php
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Gravity forms event tracking
|
| 4 |
+
*
|
| 5 |
+
* @package Gravity_Forms_Event_Tracking
|
| 6 |
+
* @author Nathan Marks <nmarks@nvisionsolutions.ca>
|
| 7 |
+
* @license GPL-2.0+
|
| 8 |
+
* @link http://www.nvisionsolutions.ca
|
| 9 |
+
* @copyright 2014 Nathan Marks
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
GFForms::include_addon_framework();
|
| 14 |
+
|
| 15 |
+
class Gravity_Forms_Event_Tracking extends GFAddOn {
|
| 16 |
+
protected $_version = "1.5.0";
|
| 17 |
+
protected $_min_gravityforms_version = "1.8.0";
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* The actual slug of this plugin is too long for GF settings to save properly.
|
| 21 |
+
* With the appended/prepended string it attempts to insert an option over
|
| 22 |
+
* 64 chars in length.
|
| 23 |
+
*
|
| 24 |
+
* @TODO Resolve this in 2.0 somehow...
|
| 25 |
+
*/
|
| 26 |
+
protected $_slug = "gravity-forms-event-tracking";
|
| 27 |
+
protected $_text_domain = "gravity-forms-google-analytics-event-tracking";
|
| 28 |
+
protected $_path = "gravity-forms-google-analytics-event-tracking/gravity-forms-event-tracking.php";
|
| 29 |
+
protected $_full_path = __FILE__;
|
| 30 |
+
protected $_url = "https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking";
|
| 31 |
+
protected $_title = "Gravity Forms Google Analytics Event Tracking";
|
| 32 |
+
protected $_short_title = "Event Tracking";
|
| 33 |
+
|
| 34 |
+
public $ua_id = false;
|
| 35 |
+
|
| 36 |
+
private static $_instance = null;
|
| 37 |
+
|
| 38 |
+
public static function get_instance() {
|
| 39 |
+
if ( self::$_instance == null ) {
|
| 40 |
+
self::$_instance = new Gravity_Forms_Event_Tracking();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
return self::$_instance;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Overriding init function to change the load_plugin_textdomain call.
|
| 49 |
+
* See comment above for explanation.
|
| 50 |
+
*/
|
| 51 |
+
public function init() {
|
| 52 |
+
|
| 53 |
+
load_plugin_textdomain( $this->_text_domain, false, $this->_text_domain . '/languages' );
|
| 54 |
+
|
| 55 |
+
add_filter( 'gform_logging_supported', array( $this, 'set_logging_supported' ) );
|
| 56 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_action_links' ) );
|
| 57 |
+
|
| 58 |
+
if ( RG_CURRENT_PAGE == 'admin-ajax.php' ) {
|
| 59 |
+
|
| 60 |
+
//If gravity forms is supported, initialize AJAX
|
| 61 |
+
if ( $this->is_gravityforms_supported() ) {
|
| 62 |
+
$this->init_ajax();
|
| 63 |
+
}
|
| 64 |
+
} else if ( is_admin() ) {
|
| 65 |
+
|
| 66 |
+
$this->init_admin();
|
| 67 |
+
|
| 68 |
+
} else {
|
| 69 |
+
|
| 70 |
+
if ( $this->is_gravityforms_supported() ) {
|
| 71 |
+
$this->init_frontend();
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Public facing init
|
| 80 |
+
*
|
| 81 |
+
* @since 1.5.0
|
| 82 |
+
*/
|
| 83 |
+
public function init_frontend() {
|
| 84 |
+
|
| 85 |
+
$this->setup();
|
| 86 |
+
|
| 87 |
+
add_filter( 'gform_preview_styles', array( $this, 'enqueue_preview_styles' ), 10, 2 );
|
| 88 |
+
add_filter( 'gform_print_styles', array( $this, 'enqueue_print_styles' ), 10, 2 );
|
| 89 |
+
add_action( 'gform_enqueue_scripts', array( $this, 'enqueue_scripts' ), 10, 2 );
|
| 90 |
+
|
| 91 |
+
if ( $this->load_ua_settings() ) {
|
| 92 |
+
$this->load_measurement_client();
|
| 93 |
+
|
| 94 |
+
// Tracking hooks
|
| 95 |
+
add_action( 'gform_after_submission', array( $this, 'track_form_after_submission' ), 10, 2 );
|
| 96 |
+
|
| 97 |
+
// IPN hook for paypal standard!
|
| 98 |
+
if ( class_exists( 'GFPayPal' ) ) {
|
| 99 |
+
add_action( 'gform_paypal_post_ipn', array( $this, 'paypal_track_form_post_ipn' ), 10, 2 );
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Load UA Settings
|
| 107 |
+
*
|
| 108 |
+
* @since 1.4.0
|
| 109 |
+
* @return bool Returns true if UA ID is loaded, false otherwise
|
| 110 |
+
*/
|
| 111 |
+
private function load_ua_settings() {
|
| 112 |
+
$gravity_forms_add_on_settings = get_option( 'gravityformsaddon_gravity-forms-event-tracking_settings', array() );
|
| 113 |
+
|
| 114 |
+
$this->ua_id = $ua_id = false;
|
| 115 |
+
|
| 116 |
+
$ua_id = $gravity_forms_add_on_settings[ 'gravity_forms_event_tracking_ua' ];
|
| 117 |
+
|
| 118 |
+
$ua_regex = "/^UA-[0-9]{5,}-[0-9]{1,}$/";
|
| 119 |
+
|
| 120 |
+
if ( preg_match( $ua_regex, $ua_id ) ) {
|
| 121 |
+
$this->ua_id = $ua_id;
|
| 122 |
+
return true;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
if ( ! $this->ua_id )
|
| 126 |
+
return false;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* Load the google measurement protocol PHP client.
|
| 131 |
+
*
|
| 132 |
+
* @since 1.4.0
|
| 133 |
+
*/
|
| 134 |
+
private function load_measurement_client() {
|
| 135 |
+
require_once( 'vendor/ga-mp/src/Racecore/GATracking/Autoloader.php');
|
| 136 |
+
Racecore\GATracking\Autoloader::register( dirname(__FILE__) . '/vendor/ga-mp/src/' );
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Handle the form after submission before sending to the event push
|
| 141 |
+
*
|
| 142 |
+
* @since 1.4.0
|
| 143 |
+
* @param array $entry Gravity Forms entry object
|
| 144 |
+
* @param array $form Gravity Forms form object
|
| 145 |
+
*/
|
| 146 |
+
public function track_form_after_submission( $entry, $form ) {
|
| 147 |
+
|
| 148 |
+
// Temporary until Gravity fix a bug
|
| 149 |
+
$entry = GFAPI::get_entry( $entry['id'] );
|
| 150 |
+
|
| 151 |
+
// We need to check if this form is using paypal standard before we push a conversion.
|
| 152 |
+
if ( class_exists( 'GFPayPal' ) ) {
|
| 153 |
+
$paypal = GFPayPal::get_instance();
|
| 154 |
+
|
| 155 |
+
// See if a PayPal standard feed exists for this form and the condition is met.
|
| 156 |
+
// If it is we need to save the GA cookie to the entry instead for return from the IPN
|
| 157 |
+
if ( $feed = $paypal->get_payment_feed( $entry ) && $paypal->is_feed_condition_met( $feed, $form, $entry ) ) {
|
| 158 |
+
gform_update_meta( $entry['id'], 'ga_cookie', $_COOKIE['_ga'] );
|
| 159 |
+
return;
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
// Push the event to google
|
| 164 |
+
$this->push_event( $entry, $form );
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* Handle the IPN response for pushing the event
|
| 169 |
+
*
|
| 170 |
+
* @since 1.4.0
|
| 171 |
+
* @param array $post_object global post array from the IPN
|
| 172 |
+
* @param array $entry Gravity Forms entry object
|
| 173 |
+
*/
|
| 174 |
+
public function paypal_track_form_post_ipn( $post_object, $entry ) {
|
| 175 |
+
// Check if the payment was completed before continuing
|
| 176 |
+
if ( strtolower( $entry['payment_status'] ) != 'paid' ) {
|
| 177 |
+
return;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// Fetch the cookie we saved previously and set it into the cookie global
|
| 181 |
+
// The php analytics library looks for this
|
| 182 |
+
$_COOKIE['_ga'] = gform_get_meta( $entry['id'], 'ga_cookie' );
|
| 183 |
+
|
| 184 |
+
$form = GFFormsModel::get_form_meta( $entry['form_id'] );
|
| 185 |
+
|
| 186 |
+
// Push the event to google
|
| 187 |
+
$this->push_event( $entry, $form );
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/**
|
| 191 |
+
* Push the Google Analytics Event!
|
| 192 |
+
*
|
| 193 |
+
* @since 1.4.0
|
| 194 |
+
* @param array $event Gravity Forms event object
|
| 195 |
+
* @param array $form Gravity Forms form object
|
| 196 |
+
*/
|
| 197 |
+
private function push_event( $entry, $form ) {
|
| 198 |
+
if ( isset( $form['gravity-forms-event-tracking'] ) && $is_disabled = rgar( $form['gravity-forms-event-tracking'], 'gaEventTrackingDisabled' ) ) {
|
| 199 |
+
return false;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
// Init tracking object
|
| 203 |
+
$this->tracking = new \Racecore\GATracking\GATracking( apply_filters( 'gform_ua_id', $this->ua_id, $form ), false );
|
| 204 |
+
$event = new \Racecore\GATracking\Tracking\Event();
|
| 205 |
+
|
| 206 |
+
// Get event defaults
|
| 207 |
+
$event_category = 'Forms';
|
| 208 |
+
$event_label = sprintf( "Form: %s ID: %s", $form['title'], $form['id'] );
|
| 209 |
+
$event_action = 'Submission';
|
| 210 |
+
|
| 211 |
+
// IF this form has payment, we should use that for the value
|
| 212 |
+
// as long a custom value hasn't been set
|
| 213 |
+
$event_value = $this->get_event_value( $entry, $form );
|
| 214 |
+
|
| 215 |
+
// Overwrite with Gravity Form Settings if necessary
|
| 216 |
+
if ( function_exists( 'rgar' ) && isset( $form['gravity-forms-event-tracking'] ) ) {
|
| 217 |
+
// Event category
|
| 218 |
+
$gf_event_category = rgar( $form['gravity-forms-event-tracking'], 'gaEventCategory' );
|
| 219 |
+
if ( !empty( $gf_event_category ) ) {
|
| 220 |
+
$event_category = GFCommon::replace_variables( $gf_event_category, $form, $entry, false, false, true, 'text' );
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
// Event label
|
| 224 |
+
$gf_event_label = rgar( $form['gravity-forms-event-tracking'], 'gaEventLabel' );
|
| 225 |
+
if ( !empty( $gf_event_label ) ) {
|
| 226 |
+
$event_label = GFCommon::replace_variables( $gf_event_label, $form, $entry, false, false, true, 'text' );
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
// Event action
|
| 230 |
+
$gf_event_action = rgar( $form['gravity-forms-event-tracking'], 'gaEventAction' );
|
| 231 |
+
if ( !empty( $gf_event_action ) ) {
|
| 232 |
+
$event_action = GFCommon::replace_variables( $gf_event_action, $form, $entry, false, false, true, 'text' );
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
// Event value
|
| 236 |
+
$gf_event_value = rgar( $form['gravity-forms-event-tracking'], 'gaEventValue' );
|
| 237 |
+
if ( !empty( $gf_event_value ) ) {
|
| 238 |
+
$event_value = GFCommon::replace_variables( $gf_event_value, $form, $entry, false, false, true, 'text' );
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
// Set our event object variables
|
| 243 |
+
$event->setEventCategory( apply_filters( 'gform_event_category', $event_category, $form ) );
|
| 244 |
+
$event->setEventAction( apply_filters( 'gform_event_action', $event_action, $form ) );
|
| 245 |
+
$event->setEventLabel( apply_filters( 'gform_event_label', $event_label, $form ) );
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
if ( $event_value = apply_filters( 'gform_event_value', $event_value, $form ) ) {
|
| 249 |
+
// Event value must be a valid float!
|
| 250 |
+
$event_value = (float) $event_value;
|
| 251 |
+
$event->setEventValue( $event_value );
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
// Pppp Push it!
|
| 255 |
+
$this->tracking->addTracking( $event );
|
| 256 |
+
|
| 257 |
+
try {
|
| 258 |
+
$this->tracking->send();
|
| 259 |
+
} catch (Exception $e) {
|
| 260 |
+
error_log( $e->getMessage() . ' in ' . get_class( $e ) );
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/**
|
| 265 |
+
* Get the event value for payment entries
|
| 266 |
+
*
|
| 267 |
+
* @since 1.4.0
|
| 268 |
+
* @param array $event Gravity Forms event object
|
| 269 |
+
* @return string/boolean Event value or false if not a payment form
|
| 270 |
+
*/
|
| 271 |
+
private function get_event_value( $entry ) {
|
| 272 |
+
$value = rgar( $entry, 'payment_amount' );
|
| 273 |
+
|
| 274 |
+
if ( ! empty( $value ) && intval( $value ) ) {
|
| 275 |
+
return intval( $value );
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
return false;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* Plugin settings fields
|
| 283 |
+
*
|
| 284 |
+
* @return array Array of plugin settings
|
| 285 |
+
*/
|
| 286 |
+
public function plugin_settings_fields() {
|
| 287 |
+
return array(
|
| 288 |
+
array(
|
| 289 |
+
'title' => __( 'Google Analytics', $this->_text_domain ),
|
| 290 |
+
'description' => __( 'Enter your UA code (UA-XXXX-Y) here.', $this->_text_domain ),
|
| 291 |
+
'fields' => array(
|
| 292 |
+
array(
|
| 293 |
+
'name' => 'gravity_forms_event_tracking_ua',
|
| 294 |
+
'label' => __( 'UA Tracking ID', $this->_text_domain ),
|
| 295 |
+
'type' => 'text',
|
| 296 |
+
'class' => 'medium',
|
| 297 |
+
'tooltip' => 'UA-XXXX-Y',
|
| 298 |
+
'feedback_callback' => array( $this, 'ua_validation' )
|
| 299 |
+
),
|
| 300 |
+
)
|
| 301 |
+
),
|
| 302 |
+
);
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
/**
|
| 306 |
+
* Form settings page title
|
| 307 |
+
*
|
| 308 |
+
* @since 1.5.0
|
| 309 |
+
* @return string Form Settings Title
|
| 310 |
+
*/
|
| 311 |
+
public function form_settings_page_title() {
|
| 312 |
+
return __( 'Event Tracking', $this->_text_domain );
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
/**
|
| 316 |
+
* Form settings icon
|
| 317 |
+
*
|
| 318 |
+
* @since 1.5.0
|
| 319 |
+
* @return string HTML Markup for icon
|
| 320 |
+
*/
|
| 321 |
+
public function form_settings_icon() {
|
| 322 |
+
return '<i class="fa fa-crosshairs"></i>';
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
/**
|
| 326 |
+
* Form settings fields
|
| 327 |
+
*
|
| 328 |
+
* @since 1.5.0
|
| 329 |
+
* @return array Array of form settings
|
| 330 |
+
*/
|
| 331 |
+
public function form_settings_fields() {
|
| 332 |
+
return array(
|
| 333 |
+
array(
|
| 334 |
+
"title" => __( 'Event Tracking Settings', $this->_text_domain ),
|
| 335 |
+
"fields" => array(
|
| 336 |
+
array(
|
| 337 |
+
"label" => "",
|
| 338 |
+
"type" => "instruction_field",
|
| 339 |
+
"name" => "instructions"
|
| 340 |
+
),
|
| 341 |
+
array(
|
| 342 |
+
"label" => __( 'Event Category', $this->_text_domain ),
|
| 343 |
+
"type" => "text",
|
| 344 |
+
"name" => "gaEventCategory",
|
| 345 |
+
"class" => "medium merge-tag-support mt-position-right",
|
| 346 |
+
"tooltip" => sprintf( '<h6>%s</h6>%s', __( 'Event Category', $this->_text_domain ), __( 'Enter your Google Analytics event category', $this->_text_domain ) ),
|
| 347 |
+
),
|
| 348 |
+
array(
|
| 349 |
+
"label" => __( 'Event Action', $this->_text_domain ),
|
| 350 |
+
"type" => "text",
|
| 351 |
+
"name" => "gaEventAction",
|
| 352 |
+
"class" => "medium merge-tag-support mt-position-right",
|
| 353 |
+
"tooltip" => sprintf( '<h6>%s</h6>%s', __( 'Event Action', $this->_text_domain ), __( 'Enter your Google Analytics event action', $this->_text_domain ) ),
|
| 354 |
+
),
|
| 355 |
+
array(
|
| 356 |
+
"label" => __( 'Event Label', $this->_text_domain ),
|
| 357 |
+
"type" => "text",
|
| 358 |
+
"name" => "gaEventLabel",
|
| 359 |
+
"class" => "medium merge-tag-support mt-position-right",
|
| 360 |
+
"tooltip" => sprintf( '<h6>%s</h6>%s', __( 'Event Label', $this->_text_domain ), __( 'Enter your Google Analytics event label', $this->_text_domain ) ),
|
| 361 |
+
),
|
| 362 |
+
array(
|
| 363 |
+
"label" => __( 'Event Value', $this->_text_domain ),
|
| 364 |
+
"type" => "text",
|
| 365 |
+
"name" => "gaEventValue",
|
| 366 |
+
"class" => "medium merge-tag-support mt-position-right",
|
| 367 |
+
"tooltip" => sprintf( '<h6>%s</h6>%s', __( 'Event Value', $this->_text_domain ), __( 'Enter your Google Analytics event value. Leave blank to omit pushing a value to Google Analytics. Or to use the purchase value of a payment based form. <strong>Note:</strong> This must be a number (int/float).', $this->_text_domain ) ),
|
| 368 |
+
),
|
| 369 |
+
)
|
| 370 |
+
),
|
| 371 |
+
array(
|
| 372 |
+
"title" => __( 'Other Settings', $this->_text_domain ),
|
| 373 |
+
"fields" => array(
|
| 374 |
+
array(
|
| 375 |
+
"label" => __( 'Disable Event Tracking', $this->_text_domain ),
|
| 376 |
+
"type" => "checkbox",
|
| 377 |
+
"name" => "gaDisableEventTracking",
|
| 378 |
+
"tooltip" => sprintf( '<h6>%s</h6>%s', __( 'Disable Event Tracking', $this->_text_domain ), __( 'Check this if you don\'t want this form to send any events to Google Analytics.', $this->_text_domain ) ),
|
| 379 |
+
"choices" => array(
|
| 380 |
+
array(
|
| 381 |
+
"label" => "Disabled",
|
| 382 |
+
"name" => "gaEventTrackingDisabled"
|
| 383 |
+
)
|
| 384 |
+
)
|
| 385 |
+
)
|
| 386 |
+
)
|
| 387 |
+
),
|
| 388 |
+
);
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* Instruction field
|
| 393 |
+
*
|
| 394 |
+
* @since 1.5.0
|
| 395 |
+
*/
|
| 396 |
+
public function single_setting_row_instruction_field(){
|
| 397 |
+
echo '
|
| 398 |
+
<tr>
|
| 399 |
+
<th colspan="2">
|
| 400 |
+
<p>' . __( "If you leave these blank, the following defaults will be used when the event is tracked", $this->_text_domain ) . ':</p>
|
| 401 |
+
<p>
|
| 402 |
+
<strong>' . __( "Event Category", $this->_text_domain ) . ':</strong> Forms<br>
|
| 403 |
+
<strong>' . __( "Event Action", $this->_text_domain ) . ':</strong> Submission<br>
|
| 404 |
+
<strong>' . __( "Event Label", $this->_text_domain ) . ':</strong> Form: {form_title} ID: {form_id}<br>
|
| 405 |
+
<strong>' . __( "Event Value", $this->_text_domain ) . ':</strong> Payment Amount (on payment forms only, otherwise nothing is sent by default)
|
| 406 |
+
</p>
|
| 407 |
+
</td>
|
| 408 |
+
</tr>';
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
/**
|
| 412 |
+
* Basic Validation
|
| 413 |
+
*
|
| 414 |
+
* @since 1.3.0
|
| 415 |
+
*/
|
| 416 |
+
public function ua_validation($input ) {
|
| 417 |
+
$input = strip_tags( stripslashes( $input ) );
|
| 418 |
+
$ua_regex = "/^UA-[0-9]{5,}-[0-9]{1,}$/";
|
| 419 |
+
if ( preg_match( $ua_regex, $input ) ) {
|
| 420 |
+
return true;
|
| 421 |
+
} else {
|
| 422 |
+
$this->log_error( __( 'Invalid UA Tracking ID', $this->_text_domain ) );
|
| 423 |
+
return false;
|
| 424 |
+
}
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
/**
|
| 428 |
+
* Upgrading functions
|
| 429 |
+
*
|
| 430 |
+
* @since 1.5.0
|
| 431 |
+
*/
|
| 432 |
+
public function upgrade( $previous_version ) {
|
| 433 |
+
|
| 434 |
+
// If the version is below 1.5.0, we need to move the form specific settings
|
| 435 |
+
if ( version_compare( $previous_version, "1.5.0" ) == -1 ) {
|
| 436 |
+
$forms = GFAPI::get_forms( true );
|
| 437 |
+
|
| 438 |
+
foreach ( $forms as $form ) {
|
| 439 |
+
$this->upgrade_old_form_settings( $form );
|
| 440 |
+
}
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
/**
|
| 446 |
+
* Upgrade old settings created prior to new settings tab
|
| 447 |
+
*
|
| 448 |
+
* @since 1.5.0
|
| 449 |
+
* @param array $form GF Form Object Array
|
| 450 |
+
*/
|
| 451 |
+
public function upgrade_old_form_settings( $form ) {
|
| 452 |
+
$settings = array( 'gaEventCategory', 'gaEventAction', 'gaEventLabel', 'gaEventValue' );
|
| 453 |
+
|
| 454 |
+
foreach( $settings as $key => $setting ) {
|
| 455 |
+
if ( isset( $form[ $setting ] ) && ( ! isset( $form[ $this->_slug ] ) || ! isset( $form[ $this->_slug ][ $setting ] ) || empty( $form[ $this->_slug ][ $setting ] ) ) ) {
|
| 456 |
+
$form[ $this->_slug ][ $setting ] = $form[ $setting ];
|
| 457 |
+
}
|
| 458 |
+
unset( $form[ $setting ] );
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
GFFormsModel::update_form_meta( $form['id'], $form );
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
/**
|
| 465 |
+
* Add settings action link to the plugins page.
|
| 466 |
+
*
|
| 467 |
+
* @since 1.0.0
|
| 468 |
+
*/
|
| 469 |
+
public function add_action_links( $links ) {
|
| 470 |
+
return array_merge(
|
| 471 |
+
array(
|
| 472 |
+
'settings' => '<a href="' . esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravity-forms-event-tracking' ) ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'
|
| 473 |
+
),
|
| 474 |
+
$links
|
| 475 |
+
);
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Autoloader.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Get the transfer Paket from current Event
|
| 25 |
+
*
|
| 26 |
+
* @return array
|
| 27 |
+
*/
|
| 28 |
+
abstract public function getPaket();
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 Event extends AbstractTracking
|
| 23 |
+
{
|
| 24 |
+
/** @var string */
|
| 25 |
+
private $appName;
|
| 26 |
+
|
| 27 |
+
/** @var string */
|
| 28 |
+
private $eventCategory;
|
| 29 |
+
|
| 30 |
+
/** @var string */
|
| 31 |
+
private $eventAction;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Set the Application Name
|
| 35 |
+
*
|
| 36 |
+
* @param string $appName
|
| 37 |
+
*/
|
| 38 |
+
public function setAppName($appName)
|
| 39 |
+
{
|
| 40 |
+
$this->appName = $appName;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Get the Application Name
|
| 45 |
+
*
|
| 46 |
+
* @return string
|
| 47 |
+
*/
|
| 48 |
+
public function getAppName()
|
| 49 |
+
{
|
| 50 |
+
return $this->appName;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Set the Event Action
|
| 55 |
+
*
|
| 56 |
+
* @param string $eventAction
|
| 57 |
+
*/
|
| 58 |
+
public function setEventAction($eventAction)
|
| 59 |
+
{
|
| 60 |
+
$this->eventAction = $eventAction;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Get the Event Action
|
| 65 |
+
*
|
| 66 |
+
* @return string
|
| 67 |
+
*/
|
| 68 |
+
public function getEventAction()
|
| 69 |
+
{
|
| 70 |
+
return $this->eventAction;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Set the Event Category
|
| 75 |
+
*
|
| 76 |
+
* @param string $eventCategory
|
| 77 |
+
*/
|
| 78 |
+
public function setEventCategory($eventCategory)
|
| 79 |
+
{
|
| 80 |
+
$this->eventCategory = $eventCategory;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Get the Event Category
|
| 85 |
+
*
|
| 86 |
+
* @return string
|
| 87 |
+
*/
|
| 88 |
+
public function getEventCategory()
|
| 89 |
+
{
|
| 90 |
+
return $this->eventCategory;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* Returns the Paket for App Event Tracking
|
| 95 |
+
*
|
| 96 |
+
* @return array
|
| 97 |
+
*/
|
| 98 |
+
public function getPaket()
|
| 99 |
+
{
|
| 100 |
+
return array(
|
| 101 |
+
't' => 'event',
|
| 102 |
+
'an' => $this->getAppName(),
|
| 103 |
+
'ec' => $this->getEventCategory(),
|
| 104 |
+
'ea' => $this->getEventAction()
|
| 105 |
+
);
|
| 106 |
+
}
|
| 107 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
/** @var string */
|
| 25 |
+
private $appName;
|
| 26 |
+
|
| 27 |
+
/** @var string */
|
| 28 |
+
private $appVersion;
|
| 29 |
+
|
| 30 |
+
/** @var string */
|
| 31 |
+
private $contentDescription;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Set the Application Name
|
| 35 |
+
*
|
| 36 |
+
* @param string $appName
|
| 37 |
+
*/
|
| 38 |
+
public function setAppName($appName)
|
| 39 |
+
{
|
| 40 |
+
$this->appName = $appName;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Get the Application Name
|
| 45 |
+
*
|
| 46 |
+
* @return string
|
| 47 |
+
*/
|
| 48 |
+
public function getAppName()
|
| 49 |
+
{
|
| 50 |
+
return $this->appName;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Set the Application Version
|
| 55 |
+
*
|
| 56 |
+
* @param string $appVersion
|
| 57 |
+
*/
|
| 58 |
+
public function setAppVersion($appVersion)
|
| 59 |
+
{
|
| 60 |
+
$this->appVersion = $appVersion;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Get the Application Version
|
| 65 |
+
*
|
| 66 |
+
* @return string
|
| 67 |
+
*/
|
| 68 |
+
public function getAppVersion()
|
| 69 |
+
{
|
| 70 |
+
return $this->appVersion;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Set the Content Description/Screen Name
|
| 75 |
+
*
|
| 76 |
+
* @param string $contentDescription
|
| 77 |
+
*/
|
| 78 |
+
public function setContentDescription($contentDescription)
|
| 79 |
+
{
|
| 80 |
+
$this->contentDescription = $contentDescription;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Get the Content Description/Screen Name
|
| 85 |
+
*
|
| 86 |
+
* @return string
|
| 87 |
+
*/
|
| 88 |
+
public function getContentDescription()
|
| 89 |
+
{
|
| 90 |
+
return $this->contentDescription;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* Returns the Paket for App Screen Tracking
|
| 95 |
+
*
|
| 96 |
+
* @return array
|
| 97 |
+
*/
|
| 98 |
+
public function getPaket()
|
| 99 |
+
{
|
| 100 |
+
return array(
|
| 101 |
+
't' => 'appview',
|
| 102 |
+
'an' => $this->getAppName(),
|
| 103 |
+
'av' => $this->getAppVersion(),
|
| 104 |
+
'cd' => $this->getContentDescription()
|
| 105 |
+
);
|
| 106 |
+
}
|
| 107 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Campaign.php
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 Campaign extends Page
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Campaign Name
|
| 27 |
+
*
|
| 28 |
+
* @var string
|
| 29 |
+
*/
|
| 30 |
+
private $name;
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Campaign Source
|
| 34 |
+
*
|
| 35 |
+
* @var string
|
| 36 |
+
*/
|
| 37 |
+
private $source;
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Campaign Medium
|
| 41 |
+
*
|
| 42 |
+
* @var string
|
| 43 |
+
*/
|
| 44 |
+
private $medium;
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Campaign Keywords
|
| 48 |
+
*
|
| 49 |
+
* @var array
|
| 50 |
+
*/
|
| 51 |
+
private $keywords = array();
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Campaign Content
|
| 55 |
+
*
|
| 56 |
+
* @var string
|
| 57 |
+
*/
|
| 58 |
+
private $content;
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Campaign ID
|
| 62 |
+
*
|
| 63 |
+
* @var integer
|
| 64 |
+
*/
|
| 65 |
+
private $cid;
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Sets the Campaign ID
|
| 69 |
+
*
|
| 70 |
+
* @param $cid
|
| 71 |
+
* @return $this
|
| 72 |
+
*/
|
| 73 |
+
public function setCampaignID($cid)
|
| 74 |
+
{
|
| 75 |
+
$this->cid = $cid;
|
| 76 |
+
return $this;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Returns the Campaign ID
|
| 81 |
+
*
|
| 82 |
+
* @return int
|
| 83 |
+
*/
|
| 84 |
+
public function getCampaignID()
|
| 85 |
+
{
|
| 86 |
+
return $this->cid;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Sets the Campaign Content Description
|
| 91 |
+
*
|
| 92 |
+
* @param $content
|
| 93 |
+
* @return $this
|
| 94 |
+
*/
|
| 95 |
+
public function setCampaignContent($content)
|
| 96 |
+
{
|
| 97 |
+
$this->content = $content;
|
| 98 |
+
return $this;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Gets the Campaign Content Description
|
| 103 |
+
*
|
| 104 |
+
* @return string
|
| 105 |
+
*/
|
| 106 |
+
public function getCampaignContent()
|
| 107 |
+
{
|
| 108 |
+
return $this->content;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Sets the Campaign Keywords
|
| 113 |
+
*
|
| 114 |
+
* @param $keywords
|
| 115 |
+
* @return $this
|
| 116 |
+
*/
|
| 117 |
+
public function setCampaignKeywords($keywords)
|
| 118 |
+
{
|
| 119 |
+
$this->keywords = $keywords;
|
| 120 |
+
return $this;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/**
|
| 124 |
+
* Return the Campaign Keywords
|
| 125 |
+
*
|
| 126 |
+
* @return array
|
| 127 |
+
*/
|
| 128 |
+
public function getCampaignKeywords()
|
| 129 |
+
{
|
| 130 |
+
return $this->keywords;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* Sets the Campaign Medium
|
| 135 |
+
*
|
| 136 |
+
* @param $medium
|
| 137 |
+
* @return $this
|
| 138 |
+
*/
|
| 139 |
+
public function setCampaignMedium($medium)
|
| 140 |
+
{
|
| 141 |
+
$this->medium = $medium;
|
| 142 |
+
return $this;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
* Gets the Campaign Medium
|
| 147 |
+
*
|
| 148 |
+
* @return string
|
| 149 |
+
*/
|
| 150 |
+
public function getCampaignMedium()
|
| 151 |
+
{
|
| 152 |
+
return $this->medium;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
/**
|
| 156 |
+
* Sets the Campaign Name
|
| 157 |
+
*
|
| 158 |
+
* @param $name
|
| 159 |
+
* @return $this
|
| 160 |
+
*/
|
| 161 |
+
public function setCampaignName($name)
|
| 162 |
+
{
|
| 163 |
+
$this->name = $name;
|
| 164 |
+
return $this;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* Get the Campaign Name
|
| 169 |
+
*
|
| 170 |
+
* @return string
|
| 171 |
+
*/
|
| 172 |
+
public function getCampaignName()
|
| 173 |
+
{
|
| 174 |
+
return $this->name;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Sets the Campaign Source
|
| 179 |
+
*
|
| 180 |
+
* @param $source
|
| 181 |
+
* @return $this
|
| 182 |
+
*/
|
| 183 |
+
public function setCampaignSource($source)
|
| 184 |
+
{
|
| 185 |
+
$this->source = $source;
|
| 186 |
+
return $this;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Get the Campaign Source
|
| 191 |
+
*
|
| 192 |
+
* @return string
|
| 193 |
+
*/
|
| 194 |
+
public function getCampaignSource()
|
| 195 |
+
{
|
| 196 |
+
return $this->source;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Returns the Paket for Campaign Tracking
|
| 201 |
+
*
|
| 202 |
+
* @return array
|
| 203 |
+
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 204 |
+
*/
|
| 205 |
+
public function getPaket()
|
| 206 |
+
{
|
| 207 |
+
|
| 208 |
+
$packet = parent::getPaket();
|
| 209 |
+
|
| 210 |
+
if (!$this->getCampaignName()) {
|
| 211 |
+
throw new MissingTrackingParameterException('Campaign Name musst be set');
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
if (!$this->getCampaignMedium()) {
|
| 215 |
+
throw new MissingTrackingParameterException('Campaign Medium musst be set');
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
if (!$this->getCampaignSource()) {
|
| 219 |
+
throw new MissingTrackingParameterException('Campaign Source musst be set');
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
return array_merge($packet, array(
|
| 223 |
+
'cn' => $this->getCampaignName(),
|
| 224 |
+
'cs' => $this->getCampaignSource(),
|
| 225 |
+
'cm' => $this->getCampaignMedium(),
|
| 226 |
+
'ck' => implode(';', $this->getCampaignKeywords()),
|
| 227 |
+
'cc' => $this->getCampaignContent(),
|
| 228 |
+
'ci' => $this->getCampaignID()
|
| 229 |
+
));
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* Set the Transaction ID
|
| 36 |
+
*
|
| 37 |
+
* @param $id
|
| 38 |
+
*/
|
| 39 |
+
public function setTransactionID($tid)
|
| 40 |
+
{
|
| 41 |
+
|
| 42 |
+
$this->tid = $tid;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Returns the Transaction ID
|
| 47 |
+
*
|
| 48 |
+
* @return integer
|
| 49 |
+
*/
|
| 50 |
+
public function getTransactionID()
|
| 51 |
+
{
|
| 52 |
+
|
| 53 |
+
if (!$this->tid) {
|
| 54 |
+
return '/';
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
return $this->tid;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Sets the Item Name
|
| 62 |
+
*
|
| 63 |
+
* @param $name
|
| 64 |
+
*/
|
| 65 |
+
public function setName($name)
|
| 66 |
+
{
|
| 67 |
+
|
| 68 |
+
$this->name = $name;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Return Name
|
| 73 |
+
*
|
| 74 |
+
* @return string
|
| 75 |
+
*/
|
| 76 |
+
public function getName()
|
| 77 |
+
{
|
| 78 |
+
|
| 79 |
+
if (!$this->name) {
|
| 80 |
+
return $this->sku;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
return $this->name;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Sets the Item Price
|
| 88 |
+
*
|
| 89 |
+
* @param $price
|
| 90 |
+
*/
|
| 91 |
+
public function setPrice($price)
|
| 92 |
+
{
|
| 93 |
+
$this->price = $price;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Return the Price
|
| 98 |
+
*
|
| 99 |
+
* @return float
|
| 100 |
+
*/
|
| 101 |
+
public function getPrice()
|
| 102 |
+
{
|
| 103 |
+
return $this->price;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Sets the Quantity
|
| 108 |
+
*
|
| 109 |
+
* @param $quantity
|
| 110 |
+
*/
|
| 111 |
+
public function setQuantity($quantity)
|
| 112 |
+
{
|
| 113 |
+
$this->quantity = $quantity;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Return Quantity
|
| 118 |
+
*
|
| 119 |
+
* @return integer
|
| 120 |
+
*/
|
| 121 |
+
public function getQuantity()
|
| 122 |
+
{
|
| 123 |
+
return $this->quantity;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* Sets the Sku
|
| 128 |
+
*
|
| 129 |
+
* @param $sku
|
| 130 |
+
*/
|
| 131 |
+
public function setSku($sku)
|
| 132 |
+
{
|
| 133 |
+
$this->sku = $sku;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* Return the Sku
|
| 138 |
+
*
|
| 139 |
+
* @return float
|
| 140 |
+
*/
|
| 141 |
+
public function getSku()
|
| 142 |
+
{
|
| 143 |
+
return $this->sku;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* Sets the Category
|
| 148 |
+
*
|
| 149 |
+
* @param $category
|
| 150 |
+
*/
|
| 151 |
+
public function setCategory($category)
|
| 152 |
+
{
|
| 153 |
+
$this->category = $category;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
/**
|
| 157 |
+
* Return the Category
|
| 158 |
+
*
|
| 159 |
+
* @return float
|
| 160 |
+
*/
|
| 161 |
+
public function getCategory()
|
| 162 |
+
{
|
| 163 |
+
return $this->category;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
/**
|
| 167 |
+
* Sets the Currency
|
| 168 |
+
*
|
| 169 |
+
* @param $currency
|
| 170 |
+
*/
|
| 171 |
+
public function setCurrency($currency)
|
| 172 |
+
{
|
| 173 |
+
$this->currency = $currency;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Return the Currency
|
| 178 |
+
*
|
| 179 |
+
* @return string
|
| 180 |
+
*/
|
| 181 |
+
public function getCurrency()
|
| 182 |
+
{
|
| 183 |
+
return $this->currency;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
public function setTransactionHost($host)
|
| 187 |
+
{
|
| 188 |
+
$this->host = $host;
|
| 189 |
+
return $this;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/**
|
| 193 |
+
* @return string
|
| 194 |
+
*/
|
| 195 |
+
public function getTransactionHost()
|
| 196 |
+
{
|
| 197 |
+
return $this->host;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
/**
|
| 201 |
+
* Returns the Google Paket for Item Tracking
|
| 202 |
+
*
|
| 203 |
+
* @return array
|
| 204 |
+
*/
|
| 205 |
+
public function getPaket()
|
| 206 |
+
{
|
| 207 |
+
if( !$this->getTransactionID() )
|
| 208 |
+
{
|
| 209 |
+
throw new MissingTrackingParameterException('transaction id is missing');
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
if( !$this->getName() )
|
| 213 |
+
{
|
| 214 |
+
throw new MissingTrackingParameterException('item name is missing');
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
return array(
|
| 218 |
+
't' => 'item',
|
| 219 |
+
'ti' => $this->getTransactionID(),
|
| 220 |
+
'in' => $this->getName(),
|
| 221 |
+
'ip' => $this->getPrice(),
|
| 222 |
+
'iq' => $this->getQuantity(),
|
| 223 |
+
'ic' => $this->getSku(),
|
| 224 |
+
'iv' => $this->getCategory(),
|
| 225 |
+
'dh' => $this->getTransactionHost(),
|
| 226 |
+
'cu' => $this->getCurrency()
|
| 227 |
+
);
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
private $host = '';
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Set the Transaction ID
|
| 36 |
+
*
|
| 37 |
+
* @param $id
|
| 38 |
+
*/
|
| 39 |
+
public function setID($id)
|
| 40 |
+
{
|
| 41 |
+
|
| 42 |
+
$this->id = $id;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Returns the Transaction ID
|
| 47 |
+
*
|
| 48 |
+
* @return integer
|
| 49 |
+
*/
|
| 50 |
+
public function getID()
|
| 51 |
+
{
|
| 52 |
+
|
| 53 |
+
if (!$this->id) {
|
| 54 |
+
return '/';
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
return $this->id;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Sets the Affiliation
|
| 62 |
+
*
|
| 63 |
+
* @param $affiliation
|
| 64 |
+
*/
|
| 65 |
+
public function setAffiliation($affiliation)
|
| 66 |
+
{
|
| 67 |
+
|
| 68 |
+
$this->affiliation = $affiliation;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Return Affiliation
|
| 73 |
+
*
|
| 74 |
+
* @return string
|
| 75 |
+
*/
|
| 76 |
+
public function getAffiliation()
|
| 77 |
+
{
|
| 78 |
+
|
| 79 |
+
return $this->affiliation;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Sets the Revenue
|
| 84 |
+
*
|
| 85 |
+
* @param $revenue
|
| 86 |
+
*/
|
| 87 |
+
public function setRevenue($revenue)
|
| 88 |
+
{
|
| 89 |
+
$this->revenue = $revenue;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Return the Revenue
|
| 94 |
+
*
|
| 95 |
+
* @return float
|
| 96 |
+
*/
|
| 97 |
+
public function getRevenue()
|
| 98 |
+
{
|
| 99 |
+
return $this->revenue;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/**
|
| 103 |
+
* Sets the Shipping
|
| 104 |
+
*
|
| 105 |
+
* @param $shipping
|
| 106 |
+
*/
|
| 107 |
+
public function setShipping($shipping)
|
| 108 |
+
{
|
| 109 |
+
$this->shipping = $shipping;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
* Return Shipping
|
| 114 |
+
*
|
| 115 |
+
* @return float
|
| 116 |
+
*/
|
| 117 |
+
public function getShipping()
|
| 118 |
+
{
|
| 119 |
+
return $this->shipping;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Sets the Tax
|
| 124 |
+
*
|
| 125 |
+
* @param $tax
|
| 126 |
+
*/
|
| 127 |
+
public function setTax($tax)
|
| 128 |
+
{
|
| 129 |
+
$this->tax = $tax;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/**
|
| 133 |
+
* Return the Tax
|
| 134 |
+
*
|
| 135 |
+
* @return float
|
| 136 |
+
*/
|
| 137 |
+
public function getTax()
|
| 138 |
+
{
|
| 139 |
+
return $this->tax;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
/**
|
| 143 |
+
* Sets the Currency
|
| 144 |
+
*
|
| 145 |
+
* @param $currency
|
| 146 |
+
*/
|
| 147 |
+
public function setCurrency($currency)
|
| 148 |
+
{
|
| 149 |
+
$this->currency = $currency;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* Return the Currency
|
| 154 |
+
*
|
| 155 |
+
* @return string
|
| 156 |
+
*/
|
| 157 |
+
public function getCurrency()
|
| 158 |
+
{
|
| 159 |
+
return $this->currency;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Return the Transaction Host Address
|
| 164 |
+
*
|
| 165 |
+
* @param $host
|
| 166 |
+
* @return $this
|
| 167 |
+
*/
|
| 168 |
+
public function setTransactionHost($host)
|
| 169 |
+
{
|
| 170 |
+
$this->host = $host;
|
| 171 |
+
return $this;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* Returns the Transaction Host
|
| 176 |
+
*
|
| 177 |
+
* @return string
|
| 178 |
+
*/
|
| 179 |
+
public function getTransactionHost()
|
| 180 |
+
{
|
| 181 |
+
return $this->host;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/**
|
| 185 |
+
* Returns the Google Paket for Transaction Tracking
|
| 186 |
+
*
|
| 187 |
+
* @return array
|
| 188 |
+
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 189 |
+
*/
|
| 190 |
+
public function getPaket()
|
| 191 |
+
{
|
| 192 |
+
if( !$this->getID() )
|
| 193 |
+
{
|
| 194 |
+
throw new MissingTrackingParameterException('transaction id is missing');
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
return array(
|
| 198 |
+
't' => 'transaction',
|
| 199 |
+
'ti' => $this->getID(),
|
| 200 |
+
'ta' => $this->getAffiliation(),
|
| 201 |
+
'tr' => $this->getRevenue(),
|
| 202 |
+
'ts' => $this->getShipping(),
|
| 203 |
+
'tt' => $this->getTax(),
|
| 204 |
+
'dh' => $this->getTransactionHost(),
|
| 205 |
+
'cu' => $this->getCurrency()
|
| 206 |
+
);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 getPaket()
|
| 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
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 getPaket()
|
| 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
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
private $documentPath = '';
|
| 24 |
+
private $host = '';
|
| 25 |
+
private $title = '';
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Set the Request Document Path
|
| 29 |
+
*
|
| 30 |
+
* @param $path
|
| 31 |
+
*/
|
| 32 |
+
public function setDocumentPath($path)
|
| 33 |
+
{
|
| 34 |
+
|
| 35 |
+
$this->documentPath = $path;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Returns the Request Document Path
|
| 40 |
+
*
|
| 41 |
+
* @return string
|
| 42 |
+
*/
|
| 43 |
+
public function getDocumentPath()
|
| 44 |
+
{
|
| 45 |
+
|
| 46 |
+
if (!$this->documentPath) {
|
| 47 |
+
return '/';
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
return $this->documentPath;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Sets the Document Title in Analytics Report
|
| 55 |
+
*
|
| 56 |
+
* @param $title
|
| 57 |
+
*/
|
| 58 |
+
public function setDocumentTitle($title)
|
| 59 |
+
{
|
| 60 |
+
|
| 61 |
+
$this->title = $title;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Return Document Title
|
| 66 |
+
*
|
| 67 |
+
* @return string
|
| 68 |
+
*/
|
| 69 |
+
public function getDocumentTitle()
|
| 70 |
+
{
|
| 71 |
+
|
| 72 |
+
return $this->title;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Return the Document Host Adress
|
| 77 |
+
*
|
| 78 |
+
* @param $host
|
| 79 |
+
* @return $this
|
| 80 |
+
*/
|
| 81 |
+
public function setDocumentHost($host)
|
| 82 |
+
{
|
| 83 |
+
$this->host = $host;
|
| 84 |
+
return $this;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Return Document Host
|
| 89 |
+
*
|
| 90 |
+
* @return string
|
| 91 |
+
*/
|
| 92 |
+
public function getDocumentHost()
|
| 93 |
+
{
|
| 94 |
+
return $this->host;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Returns the Google Paket for Campaign Tracking
|
| 99 |
+
*
|
| 100 |
+
* @return array
|
| 101 |
+
*/
|
| 102 |
+
public function getPaket()
|
| 103 |
+
{
|
| 104 |
+
return array(
|
| 105 |
+
't' => 'pageview',
|
| 106 |
+
'dh' => $this->getDocumentHost(),
|
| 107 |
+
'dp' => $this->getDocumentPath(),
|
| 108 |
+
'dt' => $this->getDocumentTitle()
|
| 109 |
+
);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 getPaket()
|
| 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
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 getPaket()
|
| 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 |
+
}
|
