Version Description
- Bugfix - Some users were experiencing PHP fatal errors upon form submission. Reverting to previously used library.
Download this release
Release Info
| Developer | ronalfy |
| Plugin | |
| Version | 1.7.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.7.1 to 1.7.3
- README.txt +9 -2
- gravity-forms-event-tracking.php +2 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Autoloader.php +74 -73
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception.php +2 -3
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception/EndpointServerException.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingConfigurationException.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingTrackingParameterException.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/GATracking.php +304 -212
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/AbstractTracking.php +685 -508
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php +15 -4
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php +7 -5
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php +1 -2
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php +1 -3
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php +1 -2
README.txt
CHANGED
|
@@ -2,10 +2,11 @@
|
|
| 2 |
Contributors: nmarks, ronalfy
|
| 3 |
Tags: gravity forms, google analytics, event tracking
|
| 4 |
Requires at least:4.0
|
| 5 |
-
Tested up to: 4.
|
| 6 |
-
Stable tag: 1.7.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
| 9 |
|
| 10 |
Add Google Analytics Event Tracking to your Gravity Forms in less than 5 minutes! Requires PHP 5.3+.
|
| 11 |
|
|
@@ -91,6 +92,9 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
|
|
| 91 |
|
| 92 |
== Changelog ==
|
| 93 |
|
|
|
|
|
|
|
|
|
|
| 94 |
= 1.7.1 =
|
| 95 |
* Released 2016-03-28
|
| 96 |
* Hotfix - Removing SSL requirement. Needs more testing.
|
|
@@ -171,6 +175,9 @@ Check out the documentation on [github](https://github.com/ronalfy/wordpress-gra
|
|
| 171 |
|
| 172 |
== Upgrade Notice ==
|
| 173 |
|
|
|
|
|
|
|
|
|
|
| 174 |
= 1.7.1 =
|
| 175 |
Removing SSL requirement. Needs more testing.
|
| 176 |
|
| 2 |
Contributors: nmarks, ronalfy
|
| 3 |
Tags: gravity forms, google analytics, event tracking
|
| 4 |
Requires at least:4.0
|
| 5 |
+
Tested up to: 4.6
|
| 6 |
+
Stable tag: 1.7.3
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
+
Donate link: https://mediaron.com/contribute/
|
| 10 |
|
| 11 |
Add Google Analytics Event Tracking to your Gravity Forms in less than 5 minutes! Requires PHP 5.3+.
|
| 12 |
|
| 92 |
|
| 93 |
== Changelog ==
|
| 94 |
|
| 95 |
+
= 1.7.3 =
|
| 96 |
+
* Bugfix - Some users were experiencing PHP fatal errors upon form submission. Reverting to previously used library.
|
| 97 |
+
|
| 98 |
= 1.7.1 =
|
| 99 |
* Released 2016-03-28
|
| 100 |
* Hotfix - Removing SSL requirement. Needs more testing.
|
| 175 |
|
| 176 |
== Upgrade Notice ==
|
| 177 |
|
| 178 |
+
= 1.7.3 =
|
| 179 |
+
Bugfix - Some users were experiencing PHP fatal errors upon form submission. Reverting to previously used library.
|
| 180 |
+
|
| 181 |
= 1.7.1 =
|
| 182 |
Removing SSL requirement. Needs more testing.
|
| 183 |
|
gravity-forms-event-tracking.php
CHANGED
|
@@ -10,9 +10,9 @@
|
|
| 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.7.
|
| 14 |
* Author: Ronald Huereca
|
| 15 |
-
* Author URI:
|
| 16 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
| 17 |
* License: GPL-2.0+
|
| 18 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
| 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.7.3
|
| 14 |
* Author: Ronald Huereca
|
| 15 |
+
* Author URI: https://mediaron.com
|
| 16 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
| 17 |
* License: GPL-2.0+
|
| 18 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
includes/vendor/ga-mp/src/Racecore/GATracking/Autoloader.php
CHANGED
|
@@ -1,73 +1,74 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
*
|
| 10 |
-
*
|
| 11 |
-
*
|
| 12 |
-
*
|
| 13 |
-
*
|
| 14 |
-
*
|
| 15 |
-
* @
|
| 16 |
-
* @
|
| 17 |
-
* @
|
| 18 |
-
* @
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
*
|
| 27 |
-
*
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 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 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
*
|
| 59 |
-
*
|
| 60 |
-
* @
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
}
|
|
|
| 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
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking;
|
| 4 |
|
| 5 |
/**
|
|
@@ -18,6 +17,6 @@ namespace Racecore\GATracking;
|
|
| 18 |
* @url http://www.racecore.de
|
| 19 |
* @package Racecore\GATracking
|
| 20 |
*/
|
| 21 |
-
class Exception extends \
|
| 22 |
{
|
| 23 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking;
|
| 3 |
|
| 4 |
/**
|
| 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
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Exception;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Exception;
|
|
@@ -22,4 +21,4 @@ use Racecore\GATracking\Exception;
|
|
| 22 |
*/
|
| 23 |
class EndpointServerException extends Exception
|
| 24 |
{
|
| 25 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Exception;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Exception;
|
| 21 |
*/
|
| 22 |
class EndpointServerException extends Exception
|
| 23 |
{
|
| 24 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingConfigurationException.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Exception;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Exception;
|
|
@@ -22,4 +21,4 @@ use Racecore\GATracking\Exception;
|
|
| 22 |
*/
|
| 23 |
class MissingConfigurationException extends Exception
|
| 24 |
{
|
| 25 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Exception;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Exception;
|
| 21 |
*/
|
| 22 |
class MissingConfigurationException extends Exception
|
| 23 |
{
|
| 24 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Exception/MissingTrackingParameterException.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Exception;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Exception;
|
|
@@ -22,4 +21,4 @@ use Racecore\GATracking\Exception;
|
|
| 22 |
*/
|
| 23 |
class MissingTrackingParameterException extends Exception
|
| 24 |
{
|
| 25 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Exception;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Exception;
|
| 21 |
*/
|
| 22 |
class MissingTrackingParameterException extends Exception
|
| 23 |
{
|
| 24 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/GATracking.php
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking;
|
| 4 |
|
| 5 |
-
use Racecore\GATracking\
|
| 6 |
-
use Racecore\GATracking\
|
| 7 |
-
use Racecore\GATracking\
|
| 8 |
-
use Racecore\GATracking\Tracking;
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Google Analytics Measurement PHP Class
|
|
@@ -25,213 +23,211 @@ use Racecore\GATracking\Tracking;
|
|
| 25 |
*/
|
| 26 |
class GATracking
|
| 27 |
{
|
| 28 |
-
/**
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
'client_fallback_id' => 555, // fallback client id when cid was not found and random client id is off
|
| 35 |
-
'client_id' => null, // override client id
|
| 36 |
-
'user_id' => null, // determine current user id
|
| 37 |
-
|
| 38 |
-
// adapter options
|
| 39 |
-
'adapter' => array(
|
| 40 |
-
'async' => true, // requests to google are async - don't wait for google server response
|
| 41 |
-
'ssl' => false // use ssl connection to google server
|
| 42 |
-
)
|
| 43 |
-
|
| 44 |
-
// use proxy
|
| 45 |
-
/**
|
| 46 |
-
'proxy' => array(
|
| 47 |
-
'ip' => '127.0.0.1', // override the proxy ip with this one
|
| 48 |
-
'user_agent' => 'override agent' // override the proxy user agent
|
| 49 |
-
),
|
| 50 |
-
**/
|
| 51 |
-
);
|
| 52 |
-
|
| 53 |
-
/** @var Client\AbstractClientAdapter */
|
| 54 |
-
private $clientAdapter = null;
|
| 55 |
-
|
| 56 |
-
/** @var string */
|
| 57 |
-
private $apiProtocolVersion = '1';
|
| 58 |
-
private $apiEndpointUrl = 'http://www.google-analytics.com/collect';
|
| 59 |
|
| 60 |
/**
|
| 61 |
-
*
|
| 62 |
-
*
|
| 63 |
-
* @
|
| 64 |
-
* @throws Exception\InvalidArgumentException
|
| 65 |
*/
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
|
| 91 |
/**
|
| 92 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
*
|
| 94 |
-
* @
|
| 95 |
*/
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
{
|
| 98 |
-
|
| 99 |
}
|
| 100 |
-
|
| 101 |
/**
|
| 102 |
-
*
|
| 103 |
*
|
| 104 |
-
* @
|
| 105 |
*/
|
| 106 |
-
public function
|
| 107 |
{
|
| 108 |
-
$this->
|
| 109 |
}
|
| 110 |
|
| 111 |
/**
|
| 112 |
-
*
|
| 113 |
*
|
| 114 |
-
* @
|
| 115 |
*/
|
| 116 |
-
public function
|
| 117 |
{
|
| 118 |
-
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
/**
|
| 122 |
-
* Set the current Client
|
| 123 |
*
|
| 124 |
-
* @param
|
|
|
|
| 125 |
*/
|
| 126 |
-
public function
|
| 127 |
{
|
| 128 |
-
$this->
|
|
|
|
| 129 |
}
|
| 130 |
|
| 131 |
/**
|
| 132 |
-
*
|
| 133 |
*
|
| 134 |
-
* @
|
| 135 |
-
* @throws Exception\InvalidArgumentException
|
| 136 |
*/
|
| 137 |
-
public function
|
| 138 |
{
|
| 139 |
-
if (
|
| 140 |
-
|
| 141 |
-
'[%s] expects array; received [%s]',
|
| 142 |
-
__METHOD__,
|
| 143 |
-
gettype($options)
|
| 144 |
-
));
|
| 145 |
}
|
| 146 |
|
| 147 |
-
$this->
|
| 148 |
}
|
| 149 |
-
|
| 150 |
/**
|
| 151 |
-
* Set
|
| 152 |
*
|
| 153 |
-
* @param $
|
| 154 |
-
* @
|
| 155 |
*/
|
| 156 |
-
public function
|
| 157 |
{
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
}
|
| 162 |
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
/**
|
| 167 |
-
* Return
|
| 168 |
*
|
| 169 |
* @return array
|
| 170 |
*/
|
| 171 |
-
public function
|
| 172 |
{
|
| 173 |
-
return $this->
|
| 174 |
}
|
| 175 |
|
| 176 |
/**
|
| 177 |
-
*
|
| 178 |
*
|
| 179 |
-
* @
|
| 180 |
-
* @return null|mixed
|
| 181 |
*/
|
| 182 |
-
public function
|
| 183 |
{
|
| 184 |
-
|
| 185 |
-
return null;
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
return $this->options[$key];
|
| 189 |
}
|
| 190 |
|
| 191 |
/**
|
| 192 |
-
*
|
| 193 |
*
|
| 194 |
-
* @param $
|
|
|
|
| 195 |
*/
|
| 196 |
-
public function
|
| 197 |
{
|
| 198 |
-
$this->
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
| 200 |
|
| 201 |
/**
|
| 202 |
-
*
|
| 203 |
*
|
| 204 |
* @return string
|
| 205 |
*/
|
| 206 |
-
|
| 207 |
{
|
| 208 |
-
$clientId = $this->getOption('client_id');
|
| 209 |
-
if ($clientId) {
|
| 210 |
-
return $clientId;
|
| 211 |
-
}
|
| 212 |
-
|
| 213 |
// collect user specific data
|
| 214 |
if (isset($_COOKIE['_ga'])) {
|
|
|
|
| 215 |
$gaCookie = explode('.', $_COOKIE['_ga']);
|
| 216 |
-
if
|
|
|
|
| 217 |
// check if uuid
|
| 218 |
-
if
|
|
|
|
| 219 |
// uuid set in cookie
|
| 220 |
return $gaCookie[2];
|
| 221 |
-
}
|
| 222 |
-
|
|
|
|
|
|
|
| 223 |
return $gaCookie[2] . '.' . $gaCookie[3];
|
| 224 |
}
|
| 225 |
}
|
| 226 |
}
|
| 227 |
|
| 228 |
-
// nothing found -
|
| 229 |
-
|
| 230 |
-
if ($generateClientId) {
|
| 231 |
-
return $this->generateUuid();
|
| 232 |
-
}
|
| 233 |
-
|
| 234 |
-
return $this->getOption('client_fallback_id');
|
| 235 |
}
|
| 236 |
|
| 237 |
/**
|
|
@@ -240,12 +236,9 @@ class GATracking
|
|
| 240 |
* @param $uuid
|
| 241 |
* @return int
|
| 242 |
*/
|
| 243 |
-
|
| 244 |
{
|
| 245 |
-
return preg_match(
|
| 246 |
-
'#^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$#i',
|
| 247 |
-
$uuid
|
| 248 |
-
);
|
| 249 |
}
|
| 250 |
|
| 251 |
/**
|
|
@@ -254,132 +247,231 @@ class GATracking
|
|
| 254 |
* @author Andrew Moore http://www.php.net/manual/en/function.uniqid.php#94959
|
| 255 |
* @return string
|
| 256 |
*/
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
return sprintf(
|
| 260 |
-
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
| 261 |
// 32 bits for "time_low"
|
| 262 |
-
mt_rand(0, 0xffff),
|
| 263 |
-
|
| 264 |
// 16 bits for "time_mid"
|
| 265 |
-
mt_rand(0, 0xffff),
|
|
|
|
| 266 |
// 16 bits for "time_hi_and_version",
|
| 267 |
// four most significant bits holds version number 4
|
| 268 |
-
mt_rand(0, 0x0fff) | 0x4000,
|
|
|
|
| 269 |
// 16 bits, 8 bits for "clk_seq_hi_res",
|
| 270 |
// 8 bits for "clk_seq_low",
|
| 271 |
// two most significant bits holds zero and one for variant DCE1.1
|
| 272 |
-
mt_rand(0, 0x3fff) | 0x8000,
|
|
|
|
| 273 |
// 48 bits for "node"
|
| 274 |
-
mt_rand(0, 0xffff),
|
| 275 |
-
mt_rand(0, 0xffff),
|
| 276 |
-
mt_rand(0, 0xffff)
|
| 277 |
);
|
| 278 |
}
|
| 279 |
|
| 280 |
/**
|
| 281 |
-
*
|
|
|
|
| 282 |
*
|
| 283 |
-
* @
|
| 284 |
-
* @return array
|
| 285 |
-
* @throws Exception\MissingConfigurationException
|
| 286 |
*/
|
| 287 |
-
|
| 288 |
{
|
| 289 |
-
|
| 290 |
-
$
|
| 291 |
-
$
|
| 292 |
-
$payloadData['uid'] = $this->getOption('user_id');
|
| 293 |
-
$payloadData['cid'] = $this->getClientId();
|
| 294 |
-
|
| 295 |
-
$proxy = $this->getOption('proxy');
|
| 296 |
-
if ($proxy) {
|
| 297 |
-
if (!isset($proxy['ip'])) {
|
| 298 |
-
throw new Exception\MissingConfigurationException('proxy options need "ip" key/value');
|
| 299 |
-
}
|
| 300 |
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
|
| 305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
}
|
| 307 |
|
| 308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
}
|
| 310 |
|
| 311 |
/**
|
| 312 |
-
*
|
| 313 |
*
|
| 314 |
-
* @param $
|
| 315 |
-
* @
|
| 316 |
* @throws Exception\MissingConfigurationException
|
| 317 |
-
* @return Request\TrackingRequestCollection
|
| 318 |
*/
|
| 319 |
-
private function
|
| 320 |
{
|
| 321 |
-
|
| 322 |
-
$
|
| 323 |
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
$payloadData = $this->getTrackingPayloadData($tracking);
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
|
| 335 |
-
$
|
| 336 |
-
$clientAdapter = $this->clientAdapter;
|
| 337 |
-
$clientAdapter->setOptions($adapterOptions);
|
| 338 |
|
| 339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
}
|
| 341 |
|
| 342 |
/**
|
| 343 |
-
*
|
| 344 |
*
|
| 345 |
-
* @param $
|
| 346 |
-
* @param null $options
|
| 347 |
* @return bool
|
|
|
|
| 348 |
*/
|
| 349 |
-
public function
|
| 350 |
{
|
| 351 |
-
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
}
|
| 354 |
|
| 355 |
-
$
|
| 356 |
-
|
| 357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
}
|
| 359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
}
|
| 361 |
|
| 362 |
/**
|
| 363 |
-
* Send
|
| 364 |
*
|
| 365 |
-
* @
|
| 366 |
-
* @return Tracking\AbstractTracking
|
| 367 |
*/
|
| 368 |
-
public function
|
| 369 |
{
|
| 370 |
-
|
| 371 |
-
$responseCollection->rewind();
|
| 372 |
-
return $responseCollection->current();
|
| 373 |
}
|
| 374 |
|
| 375 |
/**
|
| 376 |
-
*
|
| 377 |
*
|
| 378 |
-
* @param $
|
| 379 |
-
* @return
|
| 380 |
*/
|
| 381 |
-
public function
|
| 382 |
{
|
| 383 |
-
|
|
|
|
|
|
|
| 384 |
}
|
| 385 |
-
}
|
| 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
|
| 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 |
/**
|
| 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 |
/**
|
| 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
CHANGED
|
@@ -1,508 +1,685 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
*
|
| 9 |
-
*
|
| 10 |
-
*
|
| 11 |
-
*
|
| 12 |
-
*
|
| 13 |
-
*
|
| 14 |
-
*
|
| 15 |
-
*
|
| 16 |
-
*
|
| 17 |
-
* @
|
| 18 |
-
* @
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
private $
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
private $
|
| 37 |
-
|
| 38 |
-
//
|
| 39 |
-
/** @var String */
|
| 40 |
-
private $
|
| 41 |
-
|
| 42 |
-
//
|
| 43 |
-
/** @var String */
|
| 44 |
-
private $
|
| 45 |
-
|
| 46 |
-
//
|
| 47 |
-
/** @var String */
|
| 48 |
-
private $
|
| 49 |
-
|
| 50 |
-
//
|
| 51 |
-
/** @var String */
|
| 52 |
-
private $
|
| 53 |
-
|
| 54 |
-
//
|
| 55 |
-
/** @var String */
|
| 56 |
-
private $
|
| 57 |
-
|
| 58 |
-
//
|
| 59 |
-
/** @var
|
| 60 |
-
private $
|
| 61 |
-
|
| 62 |
-
//
|
| 63 |
-
/** @var String */
|
| 64 |
-
private $
|
| 65 |
-
|
| 66 |
-
//
|
| 67 |
-
/** @var
|
| 68 |
-
private $
|
| 69 |
-
|
| 70 |
-
//
|
| 71 |
-
/** @var String */
|
| 72 |
-
private $
|
| 73 |
-
|
| 74 |
-
// document
|
| 75 |
-
/** @var String */
|
| 76 |
-
private $
|
| 77 |
-
|
| 78 |
-
// document
|
| 79 |
-
/** @var String */
|
| 80 |
-
private $
|
| 81 |
-
|
| 82 |
-
//
|
| 83 |
-
/** @var String */
|
| 84 |
-
private $
|
| 85 |
-
|
| 86 |
-
//
|
| 87 |
-
/** @var String */
|
| 88 |
-
private $
|
| 89 |
-
|
| 90 |
-
//
|
| 91 |
-
/** @var String */
|
| 92 |
-
private $
|
| 93 |
-
|
| 94 |
-
//
|
| 95 |
-
/** @var String */
|
| 96 |
-
private $
|
| 97 |
-
|
| 98 |
-
//
|
| 99 |
-
/** @var String */
|
| 100 |
-
private $
|
| 101 |
-
|
| 102 |
-
//
|
| 103 |
-
/** @var String */
|
| 104 |
-
private $
|
| 105 |
-
|
| 106 |
-
//
|
| 107 |
-
/** @var
|
| 108 |
-
private $
|
| 109 |
-
|
| 110 |
-
//
|
| 111 |
-
/** @var
|
| 112 |
-
private $
|
| 113 |
-
|
| 114 |
-
//
|
| 115 |
-
/** @var
|
| 116 |
-
private $
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
* @
|
| 139 |
-
*/
|
| 140 |
-
public function
|
| 141 |
-
{
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
'
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
'
|
| 167 |
-
'
|
| 168 |
-
'
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
'
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
'
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
* @param $
|
| 235 |
-
*/
|
| 236 |
-
public function
|
| 237 |
-
{
|
| 238 |
-
$this->
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
/**
|
| 242 |
-
* @
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
namespace Racecore\GATracking\Tracking;
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Google Analytics Measurement PHP Class
|
| 6 |
+
* Licensed under the 3-clause BSD License.
|
| 7 |
+
* This source file is subject to the 3-clause BSD License that is
|
| 8 |
+
* bundled with this package in the LICENSE file. It is also available at
|
| 9 |
+
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
|
| 10 |
+
*
|
| 11 |
+
* Google Documentation
|
| 12 |
+
* https://developers.google.com/analytics/devguides/collection/protocol/v1/
|
| 13 |
+
*
|
| 14 |
+
* @author Marco Rieger
|
| 15 |
+
* @email Rieger(at)racecore.de
|
| 16 |
+
* @git https://github.com/ins0
|
| 17 |
+
* @url http://www.racecore.de
|
| 18 |
+
* @package Racecore\GATracking\Tracking
|
| 19 |
+
*/
|
| 20 |
+
abstract class AbstractTracking
|
| 21 |
+
{
|
| 22 |
+
// document referrer
|
| 23 |
+
/** @var String */
|
| 24 |
+
private $documentReferrer;
|
| 25 |
+
|
| 26 |
+
// campaign
|
| 27 |
+
/** @var String */
|
| 28 |
+
private $campaignName, $campaignSource, $campaignMedium, $campaignContent, $campaignID, $campaignKeyword;
|
| 29 |
+
|
| 30 |
+
// adwords id
|
| 31 |
+
/** @var String */
|
| 32 |
+
private $adwordsID;
|
| 33 |
+
|
| 34 |
+
// display ads id
|
| 35 |
+
/** @var String */
|
| 36 |
+
private $displayAdsID;
|
| 37 |
+
|
| 38 |
+
// screen resolution
|
| 39 |
+
/** @var String */
|
| 40 |
+
private $screenResolution;
|
| 41 |
+
|
| 42 |
+
// viewport size
|
| 43 |
+
/** @var String */
|
| 44 |
+
private $viewportSize;
|
| 45 |
+
|
| 46 |
+
// document encoding
|
| 47 |
+
/** @var String */
|
| 48 |
+
private $documentEncoding;
|
| 49 |
+
|
| 50 |
+
// screen colors
|
| 51 |
+
/** @var String */
|
| 52 |
+
private $screenColors;
|
| 53 |
+
|
| 54 |
+
// user language
|
| 55 |
+
/** @var String */
|
| 56 |
+
private $userLanguage;
|
| 57 |
+
|
| 58 |
+
// java enabled
|
| 59 |
+
/** @var boolean|string */
|
| 60 |
+
private $javaEnabled = null;
|
| 61 |
+
|
| 62 |
+
// flash version
|
| 63 |
+
/** @var String */
|
| 64 |
+
private $flashVersion;
|
| 65 |
+
|
| 66 |
+
// document location
|
| 67 |
+
/** @var String */
|
| 68 |
+
private $documentLocation;
|
| 69 |
+
|
| 70 |
+
// document host
|
| 71 |
+
/** @var String */
|
| 72 |
+
private $documentHost;
|
| 73 |
+
|
| 74 |
+
// document path
|
| 75 |
+
/** @var String */
|
| 76 |
+
private $documentPath;
|
| 77 |
+
|
| 78 |
+
// document title
|
| 79 |
+
/** @var String */
|
| 80 |
+
private $documentTitle;
|
| 81 |
+
|
| 82 |
+
// app name
|
| 83 |
+
/** @var String */
|
| 84 |
+
private $appName;
|
| 85 |
+
|
| 86 |
+
// app version
|
| 87 |
+
/** @var String */
|
| 88 |
+
private $appVersion;
|
| 89 |
+
|
| 90 |
+
// experiment id
|
| 91 |
+
/** @var String */
|
| 92 |
+
private $experimentID;
|
| 93 |
+
|
| 94 |
+
// experiment variant
|
| 95 |
+
/** @var String */
|
| 96 |
+
private $experimentVariant;
|
| 97 |
+
|
| 98 |
+
// content description
|
| 99 |
+
/** @var String */
|
| 100 |
+
private $contentDescription;
|
| 101 |
+
|
| 102 |
+
// link id
|
| 103 |
+
/** @var String */
|
| 104 |
+
private $linkID;
|
| 105 |
+
|
| 106 |
+
// custom dimensions
|
| 107 |
+
/** @var Array */
|
| 108 |
+
private $customDimension = array();
|
| 109 |
+
|
| 110 |
+
// custom metric
|
| 111 |
+
/** @var Array */
|
| 112 |
+
private $customMetric = array();
|
| 113 |
+
|
| 114 |
+
// productId
|
| 115 |
+
/** @var string */
|
| 116 |
+
private $productId;
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Get the transfer Paket from current Event
|
| 120 |
+
*
|
| 121 |
+
* @return array
|
| 122 |
+
*/
|
| 123 |
+
abstract public function createPackage();
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Returns the Paket for Event Tracking
|
| 127 |
+
*
|
| 128 |
+
* @return array
|
| 129 |
+
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 130 |
+
* @deprecated
|
| 131 |
+
*/
|
| 132 |
+
public function getPaket()
|
| 133 |
+
{
|
| 134 |
+
return $this->createPackage();
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/**
|
| 138 |
+
* @return array
|
| 139 |
+
*/
|
| 140 |
+
public function getPackage()
|
| 141 |
+
{
|
| 142 |
+
$package = array_merge($this->createPackage(), array(
|
| 143 |
+
// campaign
|
| 144 |
+
'cn' => $this->getCampaignName(),
|
| 145 |
+
'cs' => $this->getCampaignSource(),
|
| 146 |
+
'cm' => $this->getCampaignMedium(),
|
| 147 |
+
'ck' => $this->getCampaignKeyword(),
|
| 148 |
+
'cc' => $this->getCampaignContent(),
|
| 149 |
+
'ci' => $this->getCampaignID(),
|
| 150 |
+
|
| 151 |
+
// other
|
| 152 |
+
'dr' => $this->getDocumentReferrer(),
|
| 153 |
+
'gclid' => $this->getAdwordsID(),
|
| 154 |
+
'dclid' => $this->getDisplayAdsID(),
|
| 155 |
+
|
| 156 |
+
// system info
|
| 157 |
+
'sr' => $this->getScreenResolution(),
|
| 158 |
+
'sd' => $this->getScreenColors(),
|
| 159 |
+
'vp' => $this->getViewportSize(),
|
| 160 |
+
'de' => $this->getDocumentEncoding(),
|
| 161 |
+
'ul' => $this->getUserLanguage(),
|
| 162 |
+
'je' => $this->getJavaEnabled(),
|
| 163 |
+
'fl' => $this->getFlashVersion(),
|
| 164 |
+
|
| 165 |
+
// Content Information
|
| 166 |
+
'dl' => $this->getDocumentLocation(),
|
| 167 |
+
'dh' => $this->getDocumentHost(),
|
| 168 |
+
'dp' => $this->getDocumentPath(),
|
| 169 |
+
'dt' => $this->getDocumentTitle(),
|
| 170 |
+
'cd' => $this->getContentDescription(),
|
| 171 |
+
'linkid' => $this->getLinkID(),
|
| 172 |
+
|
| 173 |
+
// app tracking
|
| 174 |
+
'an' => $this->getAppName(),
|
| 175 |
+
'av' => $this->getAppVersion(),
|
| 176 |
+
|
| 177 |
+
// enhanced e-commerce
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
// content experiments
|
| 182 |
+
'xid' => $this->getExperimentID(),
|
| 183 |
+
'xvar' => $this->getExperimentVariant(),
|
| 184 |
+
));
|
| 185 |
+
|
| 186 |
+
$package = $this->addCustomParameters($package);
|
| 187 |
+
|
| 188 |
+
// remove all unused
|
| 189 |
+
$package = array_filter($package, 'strlen');
|
| 190 |
+
|
| 191 |
+
return $package;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/**
|
| 195 |
+
* @param array $package
|
| 196 |
+
* @return array
|
| 197 |
+
*/
|
| 198 |
+
private function addCustomParameters( Array $package )
|
| 199 |
+
{
|
| 200 |
+
// add custom metric params
|
| 201 |
+
foreach( $this->customMetric as $id => $value )
|
| 202 |
+
{
|
| 203 |
+
$package['cm' . (int) $id ] = $value;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// add custom dimension params
|
| 207 |
+
foreach( $this->customDimension as $id => $value )
|
| 208 |
+
{
|
| 209 |
+
$package['cd' . (int) $id ] = $value;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
return $package;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
/**
|
| 216 |
+
* @param null $id
|
| 217 |
+
* @param $value
|
| 218 |
+
*/
|
| 219 |
+
public function setCustomDimension($id = null, $value)
|
| 220 |
+
{
|
| 221 |
+
$this->customDimension[$id] = $value;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* @param null $id
|
| 226 |
+
* @param $value
|
| 227 |
+
*/
|
| 228 |
+
public function setCustomMetric($id = null, $value)
|
| 229 |
+
{
|
| 230 |
+
$this->customMetric[$id] = $value;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/**
|
| 234 |
+
* @param String $contentDescription
|
| 235 |
+
*/
|
| 236 |
+
public function setContentDescription($contentDescription)
|
| 237 |
+
{
|
| 238 |
+
$this->contentDescription = $contentDescription;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
/**
|
| 242 |
+
* @return String
|
| 243 |
+
*/
|
| 244 |
+
public function getContentDescription()
|
| 245 |
+
{
|
| 246 |
+
return $this->contentDescription;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
/**
|
| 250 |
+
* @param String $linkID
|
| 251 |
+
*/
|
| 252 |
+
public function setLinkID($linkID)
|
| 253 |
+
{
|
| 254 |
+
$this->linkID = $linkID;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
/**
|
| 258 |
+
* @return String
|
| 259 |
+
*/
|
| 260 |
+
public function getLinkID()
|
| 261 |
+
{
|
| 262 |
+
return $this->linkID;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* @param String $adwordsID
|
| 267 |
+
*/
|
| 268 |
+
public function setAdwordsID($adwordsID)
|
| 269 |
+
{
|
| 270 |
+
$this->adwordsID = $adwordsID;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/**
|
| 274 |
+
* @return String
|
| 275 |
+
*/
|
| 276 |
+
public function getAdwordsID()
|
| 277 |
+
{
|
| 278 |
+
return $this->adwordsID;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* @param String $appName
|
| 283 |
+
*/
|
| 284 |
+
public function setAppName($appName)
|
| 285 |
+
{
|
| 286 |
+
$this->appName = $appName;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
/**
|
| 290 |
+
* @return String
|
| 291 |
+
*/
|
| 292 |
+
public function getAppName()
|
| 293 |
+
{
|
| 294 |
+
return $this->appName;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
/**
|
| 298 |
+
* @param String $appVersion
|
| 299 |
+
*/
|
| 300 |
+
public function setAppVersion($appVersion)
|
| 301 |
+
{
|
| 302 |
+
$this->appVersion = $appVersion;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
/**
|
| 306 |
+
* @return String
|
| 307 |
+
*/
|
| 308 |
+
public function getAppVersion()
|
| 309 |
+
{
|
| 310 |
+
return $this->appVersion;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
/**
|
| 314 |
+
* @param String $campaignContent
|
| 315 |
+
*/
|
| 316 |
+
public function setCampaignContent($campaignContent)
|
| 317 |
+
{
|
| 318 |
+
$this->campaignContent = $campaignContent;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
/**
|
| 322 |
+
* @return String
|
| 323 |
+
*/
|
| 324 |
+
public function getCampaignContent()
|
| 325 |
+
{
|
| 326 |
+
return $this->campaignContent;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
/**
|
| 330 |
+
* @param String $campaignID
|
| 331 |
+
*/
|
| 332 |
+
public function setCampaignID($campaignID)
|
| 333 |
+
{
|
| 334 |
+
$this->campaignID = $campaignID;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
/**
|
| 338 |
+
* @return String
|
| 339 |
+
*/
|
| 340 |
+
public function getCampaignID()
|
| 341 |
+
{
|
| 342 |
+
return $this->campaignID;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
/**
|
| 346 |
+
* @param String $campaignKeyword
|
| 347 |
+
*/
|
| 348 |
+
public function setCampaignKeyword($campaignKeyword)
|
| 349 |
+
{
|
| 350 |
+
$this->campaignKeyword = $campaignKeyword;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
/**
|
| 354 |
+
* @deprecated Use setCampaignKeyword
|
| 355 |
+
* @param $campaignKeyword
|
| 356 |
+
*/
|
| 357 |
+
public function setCampaignKeywords($campaignKeyword)
|
| 358 |
+
{
|
| 359 |
+
if( is_array($campaignKeyword) )
|
| 360 |
+
{
|
| 361 |
+
return $this->setCampaignKeyword(implode(',', $campaignKeyword));
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
$this->setCampaignKeyword($campaignKeyword);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/**
|
| 368 |
+
* @return Array
|
| 369 |
+
*/
|
| 370 |
+
public function getCampaignKeyword()
|
| 371 |
+
{
|
| 372 |
+
return $this->campaignKeyword;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
/**
|
| 376 |
+
* @param String $campaignMedium
|
| 377 |
+
*/
|
| 378 |
+
public function setCampaignMedium($campaignMedium)
|
| 379 |
+
{
|
| 380 |
+
$this->campaignMedium = $campaignMedium;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
/**
|
| 384 |
+
* @return String
|
| 385 |
+
*/
|
| 386 |
+
public function getCampaignMedium()
|
| 387 |
+
{
|
| 388 |
+
return $this->campaignMedium;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* @param String $campaignName
|
| 393 |
+
*/
|
| 394 |
+
public function setCampaignName($campaignName)
|
| 395 |
+
{
|
| 396 |
+
$this->campaignName = $campaignName;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
/**
|
| 400 |
+
* @return String
|
| 401 |
+
*/
|
| 402 |
+
public function getCampaignName()
|
| 403 |
+
{
|
| 404 |
+
return $this->campaignName;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
/**
|
| 408 |
+
* @param String $campaignSource
|
| 409 |
+
*/
|
| 410 |
+
public function setCampaignSource($campaignSource)
|
| 411 |
+
{
|
| 412 |
+
$this->campaignSource = $campaignSource;
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
/**
|
| 416 |
+
* @return String
|
| 417 |
+
*/
|
| 418 |
+
public function getCampaignSource()
|
| 419 |
+
{
|
| 420 |
+
return $this->campaignSource;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/**
|
| 424 |
+
* @param String $displayAdsID
|
| 425 |
+
*/
|
| 426 |
+
public function setDisplayAdsID($displayAdsID)
|
| 427 |
+
{
|
| 428 |
+
$this->displayAdsID = $displayAdsID;
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
/**
|
| 432 |
+
* @return String
|
| 433 |
+
*/
|
| 434 |
+
public function getDisplayAdsID()
|
| 435 |
+
{
|
| 436 |
+
return $this->displayAdsID;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
/**
|
| 440 |
+
* @param String $documentEncoding
|
| 441 |
+
*/
|
| 442 |
+
public function setDocumentEncoding($documentEncoding)
|
| 443 |
+
{
|
| 444 |
+
$this->documentEncoding = $documentEncoding;
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
/**
|
| 448 |
+
* @return String
|
| 449 |
+
*/
|
| 450 |
+
public function getDocumentEncoding()
|
| 451 |
+
{
|
| 452 |
+
return $this->documentEncoding;
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
/**
|
| 456 |
+
* @param String $documentHost
|
| 457 |
+
*/
|
| 458 |
+
public function setDocumentHost($documentHost)
|
| 459 |
+
{
|
| 460 |
+
$this->documentHost = $documentHost;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
/**
|
| 464 |
+
* @return String
|
| 465 |
+
*/
|
| 466 |
+
public function getDocumentHost()
|
| 467 |
+
{
|
| 468 |
+
return $this->documentHost;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
/**
|
| 472 |
+
* @param String $documentLocation
|
| 473 |
+
*/
|
| 474 |
+
public function setDocumentLocation($documentLocation)
|
| 475 |
+
{
|
| 476 |
+
$this->documentLocation = $documentLocation;
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
/**
|
| 480 |
+
* @return String
|
| 481 |
+
*/
|
| 482 |
+
public function getDocumentLocation()
|
| 483 |
+
{
|
| 484 |
+
return $this->documentLocation;
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
/**
|
| 488 |
+
* @param String $documentPath
|
| 489 |
+
*/
|
| 490 |
+
public function setDocumentPath($documentPath)
|
| 491 |
+
{
|
| 492 |
+
$this->documentPath = $documentPath;
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
/**
|
| 496 |
+
* @return String
|
| 497 |
+
*/
|
| 498 |
+
public function getDocumentPath()
|
| 499 |
+
{
|
| 500 |
+
return $this->documentPath;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
/**
|
| 504 |
+
* @param String $documentReferrer
|
| 505 |
+
*/
|
| 506 |
+
public function setDocumentReferrer($documentReferrer)
|
| 507 |
+
{
|
| 508 |
+
$this->documentReferrer = $documentReferrer;
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
/**
|
| 512 |
+
* @return String
|
| 513 |
+
*/
|
| 514 |
+
public function getDocumentReferrer()
|
| 515 |
+
{
|
| 516 |
+
return $this->documentReferrer;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
/**
|
| 520 |
+
* @param String $documentTitle
|
| 521 |
+
*/
|
| 522 |
+
public function setDocumentTitle($documentTitle)
|
| 523 |
+
{
|
| 524 |
+
$this->documentTitle = $documentTitle;
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
/**
|
| 528 |
+
* @return String
|
| 529 |
+
*/
|
| 530 |
+
public function getDocumentTitle()
|
| 531 |
+
{
|
| 532 |
+
return $this->documentTitle;
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
/**
|
| 536 |
+
* @param String $experimentID
|
| 537 |
+
*/
|
| 538 |
+
public function setExperimentID($experimentID)
|
| 539 |
+
{
|
| 540 |
+
$this->experimentID = $experimentID;
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
/**
|
| 544 |
+
* @return String
|
| 545 |
+
*/
|
| 546 |
+
public function getExperimentID()
|
| 547 |
+
{
|
| 548 |
+
return $this->experimentID;
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
/**
|
| 552 |
+
* @param String $experimentVariant
|
| 553 |
+
*/
|
| 554 |
+
public function setExperimentVariant($experimentVariant)
|
| 555 |
+
{
|
| 556 |
+
$this->experimentVariant = $experimentVariant;
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
/**
|
| 560 |
+
* @return String
|
| 561 |
+
*/
|
| 562 |
+
public function getExperimentVariant()
|
| 563 |
+
{
|
| 564 |
+
return $this->experimentVariant;
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
/**
|
| 568 |
+
* @param String $flashVersion
|
| 569 |
+
*/
|
| 570 |
+
public function setFlashVersion($flashVersion)
|
| 571 |
+
{
|
| 572 |
+
$this->flashVersion = $flashVersion;
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
/**
|
| 576 |
+
* @return String
|
| 577 |
+
*/
|
| 578 |
+
public function getFlashVersion()
|
| 579 |
+
{
|
| 580 |
+
return $this->flashVersion;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
/**
|
| 584 |
+
* @param boolean $javaEnabled
|
| 585 |
+
*/
|
| 586 |
+
public function setJavaEnabled($javaEnabled)
|
| 587 |
+
{
|
| 588 |
+
$this->javaEnabled = (bool) $javaEnabled;
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
/**
|
| 592 |
+
* @return boolean
|
| 593 |
+
*/
|
| 594 |
+
public function getJavaEnabled()
|
| 595 |
+
{
|
| 596 |
+
if( $this->javaEnabled === null ){
|
| 597 |
+
return null;
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
return $this->javaEnabled ? '1' : '0';
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
/**
|
| 604 |
+
* @param String $screenColors
|
| 605 |
+
*/
|
| 606 |
+
public function setScreenColors($screenColors)
|
| 607 |
+
{
|
| 608 |
+
$this->screenColors = $screenColors;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
/**
|
| 612 |
+
* @return String
|
| 613 |
+
*/
|
| 614 |
+
public function getScreenColors()
|
| 615 |
+
{
|
| 616 |
+
return $this->screenColors;
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
/**
|
| 620 |
+
* @param $width
|
| 621 |
+
* @param $height
|
| 622 |
+
*/
|
| 623 |
+
public function setScreenResolution($width, $height)
|
| 624 |
+
{
|
| 625 |
+
$this->screenResolution = $width . 'x' . $height;
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
/**
|
| 629 |
+
* @return String
|
| 630 |
+
*/
|
| 631 |
+
public function getScreenResolution()
|
| 632 |
+
{
|
| 633 |
+
return $this->screenResolution;
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
/**
|
| 637 |
+
* @param String $userLanguage
|
| 638 |
+
*/
|
| 639 |
+
public function setUserLanguage($userLanguage)
|
| 640 |
+
{
|
| 641 |
+
$this->userLanguage = $userLanguage;
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
/**
|
| 645 |
+
* @return String
|
| 646 |
+
*/
|
| 647 |
+
public function getUserLanguage()
|
| 648 |
+
{
|
| 649 |
+
return $this->userLanguage;
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
/**
|
| 653 |
+
* @param $width
|
| 654 |
+
* @param $height
|
| 655 |
+
*/
|
| 656 |
+
public function setViewportSize($width, $height)
|
| 657 |
+
{
|
| 658 |
+
$this->viewportSize = $width . 'x' . $height;
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
/**
|
| 662 |
+
* @return String
|
| 663 |
+
*/
|
| 664 |
+
public function getViewportSize()
|
| 665 |
+
{
|
| 666 |
+
return $this->viewportSize;
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
/**
|
| 670 |
+
* @param string $productId
|
| 671 |
+
*/
|
| 672 |
+
public function setProductId($productId)
|
| 673 |
+
{
|
| 674 |
+
$this->productId = $productId;
|
| 675 |
+
}
|
| 676 |
+
|
| 677 |
+
/**
|
| 678 |
+
* @return string
|
| 679 |
+
*/
|
| 680 |
+
public function getProductId()
|
| 681 |
+
{
|
| 682 |
+
return $this->productId;
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking\App;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Tracking\Event as DefaultEvent;
|
|
@@ -22,4 +21,4 @@ use Racecore\GATracking\Tracking\Event as DefaultEvent;
|
|
| 22 |
*/
|
| 23 |
class Event extends DefaultEvent
|
| 24 |
{
|
| 25 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking\App;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Tracking\Event as DefaultEvent;
|
| 21 |
*/
|
| 22 |
class Event extends DefaultEvent
|
| 23 |
{
|
| 24 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking\App;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Tracking\AbstractTracking;
|
|
@@ -33,4 +32,4 @@ class Screen extends AbstractTracking
|
|
| 33 |
't' => 'appview',
|
| 34 |
);
|
| 35 |
}
|
| 36 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking\App;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Tracking\AbstractTracking;
|
| 32 |
't' => 'appview',
|
| 33 |
);
|
| 34 |
}
|
| 35 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking\Ecommerce;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
|
@@ -32,6 +31,15 @@ class Item extends AbstractTracking
|
|
| 32 |
private $category = '';
|
| 33 |
private $currency = '';
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
/**
|
| 36 |
* Set the Transaction ID
|
| 37 |
*
|
|
@@ -192,11 +200,13 @@ class Item extends AbstractTracking
|
|
| 192 |
*/
|
| 193 |
public function createPackage()
|
| 194 |
{
|
| 195 |
-
if
|
|
|
|
| 196 |
throw new MissingTrackingParameterException('transaction id is missing');
|
| 197 |
}
|
| 198 |
|
| 199 |
-
if
|
|
|
|
| 200 |
throw new MissingTrackingParameterException('item name is missing');
|
| 201 |
}
|
| 202 |
|
|
@@ -211,4 +221,5 @@ class Item extends AbstractTracking
|
|
| 211 |
'cu' => $this->getCurrency()
|
| 212 |
);
|
| 213 |
}
|
| 214 |
-
|
|
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking\Ecommerce;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
| 31 |
private $category = '';
|
| 32 |
private $currency = '';
|
| 33 |
|
| 34 |
+
/**
|
| 35 |
+
* @param $host
|
| 36 |
+
* @deprecated
|
| 37 |
+
*/
|
| 38 |
+
public function setTransactionHost( $host )
|
| 39 |
+
{
|
| 40 |
+
return $this->setDocumentHost( $host );
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
/**
|
| 44 |
* Set the Transaction ID
|
| 45 |
*
|
| 200 |
*/
|
| 201 |
public function createPackage()
|
| 202 |
{
|
| 203 |
+
if( !$this->getTransactionID() )
|
| 204 |
+
{
|
| 205 |
throw new MissingTrackingParameterException('transaction id is missing');
|
| 206 |
}
|
| 207 |
|
| 208 |
+
if( !$this->getName() )
|
| 209 |
+
{
|
| 210 |
throw new MissingTrackingParameterException('item name is missing');
|
| 211 |
}
|
| 212 |
|
| 221 |
'cu' => $this->getCurrency()
|
| 222 |
);
|
| 223 |
}
|
| 224 |
+
|
| 225 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking\Ecommerce;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
|
@@ -35,9 +34,9 @@ class Transaction extends AbstractTracking
|
|
| 35 |
* @param $host
|
| 36 |
* @deprecated
|
| 37 |
*/
|
| 38 |
-
public function setTransactionHost($host)
|
| 39 |
{
|
| 40 |
-
return $this->setDocumentHost($host);
|
| 41 |
}
|
| 42 |
|
| 43 |
/**
|
|
@@ -47,6 +46,7 @@ class Transaction extends AbstractTracking
|
|
| 47 |
*/
|
| 48 |
public function setID($id)
|
| 49 |
{
|
|
|
|
| 50 |
$this->id = $id;
|
| 51 |
}
|
| 52 |
|
|
@@ -175,7 +175,8 @@ class Transaction extends AbstractTracking
|
|
| 175 |
*/
|
| 176 |
public function createPackage()
|
| 177 |
{
|
| 178 |
-
if
|
|
|
|
| 179 |
throw new MissingTrackingParameterException('transaction id is missing');
|
| 180 |
}
|
| 181 |
|
|
@@ -189,4 +190,5 @@ class Transaction extends AbstractTracking
|
|
| 189 |
'cu' => $this->getCurrency()
|
| 190 |
);
|
| 191 |
}
|
| 192 |
-
|
|
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking\Ecommerce;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
| 34 |
* @param $host
|
| 35 |
* @deprecated
|
| 36 |
*/
|
| 37 |
+
public function setTransactionHost( $host )
|
| 38 |
{
|
| 39 |
+
return $this->setDocumentHost( $host );
|
| 40 |
}
|
| 41 |
|
| 42 |
/**
|
| 46 |
*/
|
| 47 |
public function setID($id)
|
| 48 |
{
|
| 49 |
+
|
| 50 |
$this->id = $id;
|
| 51 |
}
|
| 52 |
|
| 175 |
*/
|
| 176 |
public function createPackage()
|
| 177 |
{
|
| 178 |
+
if( !$this->getID() )
|
| 179 |
+
{
|
| 180 |
throw new MissingTrackingParameterException('transaction id is missing');
|
| 181 |
}
|
| 182 |
|
| 190 |
'cu' => $this->getCurrency()
|
| 191 |
);
|
| 192 |
}
|
| 193 |
+
|
| 194 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
|
@@ -146,4 +145,4 @@ class Event extends AbstractTracking
|
|
| 146 |
'ev' => $this->getEventValue()
|
| 147 |
);
|
| 148 |
}
|
| 149 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
| 145 |
'ev' => $this->getEventValue()
|
| 146 |
);
|
| 147 |
}
|
| 148 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking;
|
| 4 |
|
| 5 |
/**
|
|
@@ -83,4 +82,4 @@ class Exception extends AbstractTracking
|
|
| 83 |
'exf' => ( $this->getExceptionFatal() ? '1' : '0' )
|
| 84 |
);
|
| 85 |
}
|
| 86 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking;
|
| 3 |
|
| 4 |
/**
|
| 82 |
'exf' => ( $this->getExceptionFatal() ? '1' : '0' )
|
| 83 |
);
|
| 84 |
}
|
| 85 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking;
|
| 4 |
|
| 5 |
/**
|
|
@@ -31,4 +30,4 @@ class Page extends AbstractTracking
|
|
| 31 |
't' => 'pageview',
|
| 32 |
);
|
| 33 |
}
|
| 34 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking;
|
| 3 |
|
| 4 |
/**
|
| 30 |
't' => 'pageview',
|
| 31 |
);
|
| 32 |
}
|
| 33 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking;
|
| 4 |
-
|
| 5 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
| 6 |
|
| 7 |
/**
|
|
@@ -124,4 +122,4 @@ class Social extends AbstractTracking
|
|
| 124 |
'st' => $this->getSocialTarget()
|
| 125 |
);
|
| 126 |
}
|
| 127 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking;
|
|
|
|
| 3 |
use Racecore\GATracking\Exception\MissingTrackingParameterException;
|
| 4 |
|
| 5 |
/**
|
| 122 |
'st' => $this->getSocialTarget()
|
| 123 |
);
|
| 124 |
}
|
| 125 |
+
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
namespace Racecore\GATracking\Tracking\User;
|
| 4 |
|
| 5 |
use Racecore\GATracking\Tracking\AbstractTracking;
|
|
@@ -248,4 +247,4 @@ class Timing extends AbstractTracking
|
|
| 248 |
'srt' => $this->getBrowserServerResponseTime()
|
| 249 |
);
|
| 250 |
}
|
| 251 |
-
}
|
| 1 |
<?php
|
|
|
|
| 2 |
namespace Racecore\GATracking\Tracking\User;
|
| 3 |
|
| 4 |
use Racecore\GATracking\Tracking\AbstractTracking;
|
| 247 |
'srt' => $this->getBrowserServerResponseTime()
|
| 248 |
);
|
| 249 |
}
|
| 250 |
+
}
|
